[issue16078] Calendar.leapdays(y1,y2) bug
Peter Inglesby added the comment: This behaviour is correct. Years divisible by 4 are leap years, except years divisible by 100, except years divisible 400. Source http://en.wikipedia.org/wiki/Leap_year. -- nosy: +inglesp ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16078 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16078] Calendar.leapdays(y1,y2) bug
Changes by Peter Inglesby peter.ingle...@gmail.com: -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16078 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16055] incorrect error text for int(base=1000, x='1')
Peter Inglesby added the comment: The attached patch updates the error message to: int(base=100, x='123') Traceback (most recent call last): File stdin, line 1, in module ValueError: int() base must be = 2 and = 36, or 0 -- keywords: +patch nosy: +inglesp Added file: http://bugs.python.org/file27328/issue16055.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16055 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16055] incorrect error text for int(base=1000, x='1')
Peter Inglesby added the comment: Ah, sorry about that. Are you happy for me to write the test? Poking around the C API docs suggests that I should call PyErr_Fetch() to get the value of the a raised exception, but I can't see any precedent for this in existing test code. Can you point me to something I could use for inspiration? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16055 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16073] fix map() statement in list comprehension example
Peter Inglesby added the comment: Have attached a patch with suggested update. Have also grepped for similar issues elsewhere in documentation, and haven't found anything, but may have missed something. -- keywords: +patch nosy: +inglesp Added file: http://bugs.python.org/file27332/issue16073.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16073 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16055] incorrect error text for int(base=1000, x='1')
Peter Inglesby added the comment: Ok, I've now attached a patch with tests. -- Added file: http://bugs.python.org/file27353/issue16055-fix-with-tests.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16055 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21435] Segfault with cyclic reference and asyncio.Future
New submission from Peter Inglesby: The following code causes a segfault when run under Python3.4+ on OSX10.9. # segfaulter.py import asyncio class A: pass class B: def __init__(self, future): self.future = future def __del__(self): self.a = None @asyncio.coroutine def do_work(future): a = A() b = B(asyncio.Future()) a.b = b b.a = a future.set_result(None) future = asyncio.Future() asyncio.Task(do_work(future)) loop = asyncio.get_event_loop() loop.run_until_complete(future) It does matter that the Future is passed to b's __init__ method. It doesn't matter whether the Future has been resolved. Attached is the problem report generated by OSX on the crash. -- files: problemreport.txt messages: 217918 nosy: inglesp priority: normal severity: normal status: open title: Segfault with cyclic reference and asyncio.Future type: crash versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file35152/problemreport.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21435] Segfault in gc with cyclic trash
Peter Inglesby added the comment: It was actually through playing with aiohttp that I first hit this issue. I think I originally hit the problem with something like: import asyncio import aiohttp @asyncio.coroutine def do_work(future): response = yield from aiohttp.request('get', 'http://google.com') future.set_result(None) loop = asyncio.get_event_loop() future = asyncio.Future() asyncio.Task(do_work(future)) future.add_done_callback(print) loop.run_forever() -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21435 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21924] Cannot import anything that imports tokenize from script called token.py
New submission from Peter Inglesby: A script called token.py that imports anything that ends up importing tokenize, such as logging, triggers the following error when the script is run: $ cat token.py import tokenize $ python3 token.py Traceback (most recent call last): File token.py, line 1, in module import tokenize File /usr/local/Cellar/python3/3.4.0/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py, line 38, in module __all__ = token.__all__ + [COMMENT, tokenize, detect_encoding, AttributeError: 'module' object has no attribute '__all__' -- messages: 222386 nosy: inglesp priority: normal severity: normal status: open title: Cannot import anything that imports tokenize from script called token.py versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21924 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16482] pdb.set_trace() clobbering traceback on error
Peter Inglesby added the comment: I've just hit this. Is there anything I can do to help get this fixed?` -- nosy: +inglesp ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16482 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26560] Error in assertion in wsgiref.handlers.BaseHandler.start_response
New submission from Peter Inglesby: The line: assert int(status[:3]),"Status message must begin w/3-digit code" should be something like: assert status[:3].isnumeric(), "Status message must begin w/3-digit code" -- components: Library (Lib) messages: 261773 nosy: inglesp priority: normal severity: normal status: open title: Error in assertion in wsgiref.handlers.BaseHandler.start_response ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26560> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26583] test_timestamp_overflow fails
Peter Inglesby added the comment: The problem is that I have PYTHONDONTWRITEBYTECODE set in my environment. Should the setUp and tearDown methods ensure that PYTHONDONTWRITEBYTECODE is cleared and reset? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26583> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26583] test_timestamp_overflow fails
Peter Inglesby added the comment: I can reproduce it reliably. I ran ./configure with --with-pydebug. I'm not using NFS, and I'm not aware of anything else unusual about my filesystem. The fact that a timestamp overflows in the failing test is a red herring -- the following also fails, with os.stat raising FileNotFoundError: def test_without_timestamp_overflow(self): sys.path.insert(0, os.curdir) try: source = TESTFN + ".py" compiled = importlib.util.cache_from_source(source) with open(source, 'w') as f: pass __import__(TESTFN) os.stat(compiled) finally: del sys.path[0] remove_files(TESTFN) I've verified that TESTFN does get imported by writing 'print("hello")' to the source file. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26583> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26560] Error in assertion in wsgiref.handlers.BaseHandler.start_response
Peter Inglesby added the comment: I found it while reading the source. Patch attached. -- keywords: +patch Added file: http://bugs.python.org/file42188/issue26560.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26560> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26583] test_timestamp_overflow fails
New submission from Peter Inglesby: I get the following test failure against changeset 100576 on OSX 10.9.5: $ ./python.exe -m test test_import [1/1] test_import test test_import failed -- Traceback (most recent call last): File "/Users/peteringlesby/src/cpython/Lib/test/test_import/__init__.py", line 301, in test_timestamp_overflow os.stat(compiled) FileNotFoundError: [Errno 2] No such file or directory: '__pycache__/@test_68937_tmp.cpython-36.pyc' 1 test failed: test_import -- messages: 261919 nosy: inglesp priority: normal severity: normal status: open title: test_timestamp_overflow fails versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26583> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22377] %Z in strptime doesn't match EST and others
Peter Inglesby added the comment: Given the difference between the documented and the actual behaviours, and given that it's apparently not obvious what the correct fix should be, would a patch that updates the docs (to say that %Z only matched GMT and UTC) be welcome? -- nosy: +inglesp ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22377> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28776] Duplicate method names should be an error
New submission from Peter Inglesby: It should be an error for a class to define a method twice. That is, Python should raise an exception when the following code is loaded: class C: def m(self): # do something def m(self): # do something I have just witnessed a beginner get very confused by this! (Apologies if this is a duplicate of an existing issue.) -- messages: 281513 nosy: inglesp priority: normal severity: normal status: open title: Duplicate method names should be an error ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28776> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28776] Duplicate method names should be an error
Peter Inglesby added the comment: Victor, I'm not talking about redefining a method, and David, I don't think I'm talking about changing dynamic nature of the class dictionary. All I'm suggesting is that if some code contains a class whose body defines the same method twice, Python should treat it as an error. At the moment, as far as I can tell, the first method is ignored. Is there any situation where this behaviour is useful? Python already handles a somewhat similar situation by raising a SyntaxError when it encounters a function whose parameter list contains duplicates: >>> def f(a, a): ... pass ... File "", line 1 SyntaxError: duplicate argument 'a' in function definition -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28776> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28776] Duplicate method names should be an error
Peter Inglesby added the comment: OK, I'll defer to your collective decades of experience and wisdom! Thanks for all you all do for Python. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28776> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28729] Exception from sqlite3 adapter masked by sqlite3.InterfaceError
New submission from Peter Inglesby: The following code raises `sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.` when I would expect it to raise `AssertionError: Problem in adapter`. import sqlite3 class Point: def __init__(self, x, y): self.x, self.y = x, y def adapt_point(point): assert False, 'Problem in adapter' sqlite3.register_adapter(Point, adapt_point) con = sqlite3.connect(":memory:") cur = con.cursor() p = Point(4.0, -3.2) cur.execute("select ?", (p,)) -- messages: 281066 nosy: inglesp priority: normal severity: normal status: open title: Exception from sqlite3 adapter masked by sqlite3.InterfaceError type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28729> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com