Skip to content

Commit 2be6c6a

Browse files
committed
Address review comments
1 parent ee43f5f commit 2be6c6a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

Lib/test/test_lazy_import/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def test_lazy_import_type_attributes_accessible(self):
280280
@support.requires_subprocess()
281281
def test_lazy_import_type_attribute_error_message(self):
282282
"""Check that LazyImportType attribute error message is helpful."""
283-
code = textwrap.dedent(f"""
283+
code = textwrap.dedent("""
284284
lazy import asyncio
285285
try:
286286
globals()["asyncio"].Task
@@ -294,6 +294,7 @@ def test_lazy_import_type_attribute_error_message(self):
294294
""")
295295
assert_python_ok("-c", code)
296296

297+
297298
class SyntaxRestrictionTests(LazyImportTestCase):
298299
"""Tests for syntax restrictions on lazy imports."""
299300

Objects/lazyimportobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ lazy_import_dealloc(PyObject *op)
8383

8484
/* Specialize the error message for failed attribute lookups. */
8585
static PyObject *
86-
lazy_import_getattro(PyObject *op, PyObject *name) {
86+
lazy_import_getattro(PyObject *op, PyObject *name)
87+
{
8788
PyObject *value = _PyObject_GenericGetAttrWithDict(op, name, NULL, /* suppress */1);
8889
if (value == NULL) {
8990
if (PyErr_Occurred()) {
90-
/* Bubble up earlier unrelated exception */
91+
// pass up non-AttributeError exception
9192
return NULL;
9293
}
9394
PyObject *lz_name = _PyLazyImport_GetName(op);

0 commit comments

Comments
 (0)