Skip to content

Commit

Permalink
remove dedent, fix whitespace, use bool
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Jan 28, 2024
1 parent 24ccd8a commit 47d7f6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ def test_cwd_script_shadowing_stdlib(self):
collections.does_not_exist

def test_shadowing_stdlib_sys_edge_cases(self):
program = textwrap.dedent('''
program = '''
import collections
import os
import types
Expand All @@ -845,7 +845,7 @@ class substr(str):
collections.does_not_exist
except AttributeError as e:
print(str(e))
''')
'''
popen = script_helper.spawn_python('-c', program)
stdout, stderr = popen.communicate()
self.assertEqual(stdout.splitlines(), [
Expand Down
4 changes: 2 additions & 2 deletions Objects/moduleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ _Py_module_getattro_impl(PyModuleObject *m, PyObject *name, int suppress)
}
}

int is_script_shadowing_stdlib = 0;
bool is_script_shadowing_stdlib = 0;
// Check mod.__name__ in sys.stdlib_module_names
// and os.path.dirname(mod.__spec__.origin) == os.getcwd()
if (origin) {
Expand All @@ -862,7 +862,7 @@ _Py_module_getattro_impl(PyModuleObject *m, PyObject *name, int suppress)
int rc = PySet_Contains(stdlib, mod_name);
if (rc == 1) {
wchar_t cwd[MAXPATHLEN], origin_dirname[MAXPATHLEN];
if(_Py_wgetcwd(cwd, MAXPATHLEN)) {
if (_Py_wgetcwd(cwd, MAXPATHLEN)) {
if (PyUnicode_AsWideChar(origin, origin_dirname, MAXPATHLEN) < 0) {
goto done;
}
Expand Down

0 comments on commit 47d7f6c

Please sign in to comment.