This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_email and Lib/email/_policybase.py failures with -OO
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: works for me
Dependencies: Superseder: pyo's are not overwritten by different optimization levels
View: 1538778
Assigned To: Nosy List: barry, ezio.melotti, francismb, r.david.murray, serhiy.storchaka
Priority: normal Keywords: easy

Created on 2013-11-16 18:21 by ezio.melotti, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg203072 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-11-16 18:21
From #19535:
$ ./python -OO -m test -v test_email 

[...]

======================================================================
ERROR: test_policy (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/wolf/dev/py/py3k/Lib/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/home/wolf/dev/py/py3k/Lib/unittest/case.py", line 571, in run
    testMethod()
  File "/home/wolf/dev/py/py3k/Lib/unittest/loader.py", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: test_policy
Traceback (most recent call last):
  File "/home/wolf/dev/py/py3k/Lib/unittest/loader.py", line 272, in _find_tests
    module = self._get_module_from_name(name)
  File "/home/wolf/dev/py/py3k/Lib/unittest/loader.py", line 250, in _get_module_from_name
    __import__(name)
  File "/home/wolf/dev/py/py3k/Lib/test/test_email/test_policy.py", line 5, in <module>
    import email.policy
  File "/home/wolf/dev/py/py3k/Lib/email/policy.py", line 22, in <module>
    class EmailPolicy(Policy):
  File "/home/wolf/dev/py/py3k/Lib/email/_policybase.py", line 101, in _extend_docstrings
    cls.__doc__ = _append_doc(cls.__bases__[0].__doc__, cls.__doc__)
  File "/home/wolf/dev/py/py3k/Lib/email/_policybase.py", line 95, in _append_doc
    doc = doc.rsplit('\n', 1)[0]
AttributeError: 'NoneType' object has no attribute 'rsplit'

----------------------------------------------------------------------
Ran 68 tests in 0.028s

FAILED (errors=11)
Warning -- sys.path was modified by test_email
test test_email failed
1 test failed:
    test_email
msg203333 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-11-19 00:37
I can't get this to fail.  The code handles None docstrings correctly (_append_doc is not called if the __doc__ attribute is None).

The only way I can see this error arising would be if the _policybase.pyo file had docstrings stripped, but the policy.pyo file did not.  I consider that a bug in .pyo and -O/-OO handling, so I'd like to close this as "works for me".
msg203430 - (view) Author: Francis MB (francismb) * Date: 2013-11-19 21:49
Actual tip:
changeset: 87276:2012e85638d9
date: Tue Nov 19 11:43:38 2013 -0800

It's a fresh clone, then:
make clean
./configure --with-pydebug
make -j4
./python -OO -m test -v test_email

== CPython 3.4.0a4+ (default:2012e85638d9, Nov 19 2013, 22:40:39) [GCC 4.7.2]
==   Linux-3.2.0-4-amd64-x86_64-with-debian-7.2 little-endian
==   /home/ci/Prog/cpython_test/cpython/build/test_python_30828
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=2, dont_write_bytecode=0, no_user_site=0, no_site=0, igno
re_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[1/1] test_email
test_b_case_ignored (test__encoded_words.TestDecode) ... ok
....
and so on
....

Ran 1516 tests in 8.313s

OK (skipped=1)
1 test OK.
msg203436 - (view) Author: Francis MB (francismb) * Date: 2013-11-19 22:05
small correction:

a fresh clone, then:
./configure --with-pydebug
make -j4
./python -OO -m test -v test_email
msg204392 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-11-25 20:14
Lacking feedback in the negative, I'm closing this.
History
Date User Action Args
2022-04-11 14:57:53adminsetgithub: 63825
2013-11-25 20:14:06r.david.murraysetstatus: open -> closed

messages: + msg204392
2013-11-19 22:05:33francismbsetmessages: + msg203436
2013-11-19 21:49:52francismbsetstatus: pending -> open
nosy: + francismb
messages: + msg203430

2013-11-19 01:08:41r.david.murraysetstatus: open -> pending
2013-11-19 01:08:31r.david.murraysetstatus: pending -> open
superseder: pyo's are not overwritten by different optimization levels
2013-11-19 00:37:01r.david.murraysetstatus: open -> pending
resolution: works for me
messages: + msg203333

stage: needs patch -> resolved
2013-11-16 18:22:49ezio.melottilinkissue19535 dependencies
2013-11-16 18:21:09ezio.melotticreate