Skip to content

Commit 056e86e

Browse files
committed
gh-153569: remove unused source views and unrelated test cleanup
1 parent d6be4f7 commit 056e86e

4 files changed

Lines changed: 4 additions & 27 deletions

File tree

Lib/test/support/os_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _rmtree_inner(path):
433433
% (fullname, exc),
434434
file=sys.__stderr__)
435435
mode = 0
436-
if stat.S_ISDIR(mode) and not os.path.isjunction(fullname):
436+
if stat.S_ISDIR(mode):
437437
_waitfor(_rmtree_inner, fullname, waitall=True)
438438
_force_run(fullname, os.rmdir, fullname)
439439
else:

Modules/_testinternalcapi/tokenizer.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,9 @@ test_tokenizer_source(PyObject *Py_UNUSED(module),
5151
goto error;
5252
}
5353

54-
Py_ssize_t view_len;
55-
const char *view = _PyTok_SourceSpanView(
56-
&source, _PyTok_SpanFromBounds(6, 8), &view_len);
57-
if (check(view != NULL && view_len == 2 &&
58-
memcmp(view, "\xce\xb2", 2) == 0,
59-
"wrong source span view") < 0 ||
60-
check_system_error(
61-
_PyTok_SourceSpanView(
62-
&source, _PyTok_SpanFromBounds(0, source.len + 1),
63-
&view_len) == NULL,
64-
"accepted invalid source span") < 0) {
54+
if (check(source.len == 9 &&
55+
memcmp(source.bytes, "alpha\n\xce\xb2\n", 10) == 0,
56+
"wrong source contents") < 0) {
6557
goto error;
6658
}
6759

Parser/tokenizer/source.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,6 @@ _PyTok_SourceAppendLine(_PyTok_SourceText *source, const char *bytes,
134134
return start;
135135
}
136136

137-
const char *
138-
_PyTok_SourceSpanView(const _PyTok_SourceText *source, _PyTok_Span span,
139-
Py_ssize_t *len)
140-
{
141-
if (!_PyTok_SpanIsValid(span) || span.end > source->len || len == NULL) {
142-
PyErr_SetString(PyExc_SystemError, "invalid tokenizer source span");
143-
return NULL;
144-
}
145-
*len = span.end - span.start;
146-
return source->bytes == NULL ? "" : source->bytes + span.start;
147-
}
148-
149137
int
150138
_PyTok_SourceLineIsImplicit(const _PyTok_SourceText *source, int lineno)
151139
{

Parser/tokenizer/source.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ PyAPI_FUNC(void) _PyTok_SourceClear(_PyTok_SourceText *);
3737
PyAPI_FUNC(_PyTok_Off) _PyTok_SourceAppendLine(
3838
_PyTok_SourceText *source, const char *bytes, Py_ssize_t len,
3939
int implicit_newline);
40-
/* The returned view is invalidated by SourceAppendLine and SourceClear. */
41-
PyAPI_FUNC(const char *) _PyTok_SourceSpanView(
42-
const _PyTok_SourceText *, _PyTok_Span, Py_ssize_t *);
4340
/* Return false for invalid line numbers and the virtual EOF line. */
4441
PyAPI_FUNC(int) _PyTok_SourceLineIsImplicit(
4542
const _PyTok_SourceText *, int);

0 commit comments

Comments
 (0)