[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-07-13 Thread Stefan Krah
Stefan Krah added the comment: Hmm, that took about 20 min to commit a 3 line diff. Now I'm watching the buildbots... -- ___ Python tracker <http://bugs.python.org/is

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-07-13 Thread Stefan Krah
Stefan Krah added the comment: Stéphane, if you want the libmpdec change cherry picked and are willing to do the (significant) work of backporting, I'll merge it. -- ___ Python tracker <http://bugs.python.org/is

[issue30403] PEP 547: Running extension modules using -m switch

2017-07-22 Thread Stefan Behnel
Stefan Behnel added the comment: FYI, I've finally managed to find the time for implementing PEP 489 style module initialisation in Cython. It was so easy that I'm sorry it took me so long to get started. Cython 0.26 is fresh out, so the feature should go into 0.27. https://github.

[issue13429] provide __file__ to extension init function

2017-07-24 Thread Stefan Behnel
Stefan Behnel added the comment: This has been resolved by PEP 489, issue 24268. The module initialisation process receives the complete ModuleSpec now, starting with CPython 3.5, and can do with it whatever it likes, before executing any user code. -- resolution: -> duplicate st

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-07-25 Thread Stefan Krah
Stefan Krah added the comment: Well, it's not a bug, but perhaps it is annoying for users of this gcc version if they compile 3.6 often. Actually, I think gcc should not include this warning in -Wextra. It's something that could be run manually before a release. I'd vote

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-07-25 Thread Stefan Krah
Stefan Krah added the comment: We can check for the version, but all versions of gcc that I tested accept and ignore -Wno-implicit-fallthrough, even though they don't actually have -Wimplicit-fallthrough. Of course they choke on -Wimplicit-fallthro

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-07-25 Thread Stefan Krah
Stefan Krah added the comment: I think the fall-through blog notes are slightly overstated. :-) "The switch fallthrough has been widely considered a design defect in C." It's an important feature. -- ___ Python tracker <http

[issue31071] Bad error message about maps not iterable

2017-07-28 Thread Stefan Pochmann
New submission from Stefan Pochmann: Python 3.6 makes it sound like maps aren't iterable: >>> map(str, *map(int, [[]])) Traceback (most recent call last): File "", line 1, in map(str, *map(int, [[]])) TypeError: type object argument after * must be an iterable, no

[issue31079] mathematically wrong results from int and long bit_length methods

2017-07-30 Thread Stefan Krah
Stefan Krah added the comment: Look at Include/longobject.h and https://docs.python.org/3/library/stdtypes.html?highlight=bit_length#int.bit_length . -- nosy: +skrah ___ Python tracker <http://bugs.python.org/issue31

[issue31079] mathematically wrong results from int and long bit_length methods

2017-07-30 Thread Stefan Krah
Stefan Krah added the comment: Thank you for your expertise. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.or

[issue31082] reduce takes iterable, not just sequence

2017-07-30 Thread Stefan Pochmann
New submission from Stefan Pochmann: functools.reduce has a parameter called "iterable" and it only needs to be an iterable, not a sequence. The paragraph documenting it says "sequence" instead of "iterable" six times: https://docs.python.org/3/library/functools.h

[issue31091] remove dead code in PyErr_GivenExceptionMatches()

2017-07-31 Thread Stefan Behnel
New submission from Stefan Behnel: PyObject *exception, *value, *tb; PyErr_Fetch(&exception, &value, &tb); /* PyObject_IsSubclass() can recurse and therefore is not safe (see test_bad_getattr in test.pickletester). */ res = PyType_IsSubtype((PyType

[issue31091] remove dead code in PyErr_GivenExceptionMatches()

2017-07-31 Thread Stefan Behnel
Stefan Behnel added the comment: Looks like the switch from PyObject_IsSubclass() to PyType_IsSubtype() was made during the original Py3 development cycle. It should thus be safe to assume that the semantics are "as designed". :) What about applying the patch also to 3.6

[issue31113] Stack overflow with large program

2017-08-03 Thread Stefan Behnel
Stefan Behnel added the comment: 1) Is this reproducible? 2) Getting a crash in compile.c indicates that this is happening at parse/compile time and not when your Python code is executing. Can you confirm that? Does it generate a .pyc file on import that would indicate a successful byte code

[issue30717] Add unicode grapheme cluster break algorithm

2017-08-03 Thread Stefan Behnel
Stefan Behnel added the comment: Wouldn't this be a typical case where we'd expect a module to evolve and gain usage on PyPI first, before adding it to the stdlib? Searching for "grapheme" in PyPI gives some results for me. Even if they do not cover what this ticket asks

[issue31113] Stack overflow with large program

2017-08-03 Thread Stefan Behnel
Stefan Behnel added the comment: I've looked at the file and it contains a huge amount of deeply nested if-statements. Given that parsers and compilers are typically recursive, I can well imagine that this is a problem, and my guess is that it's most likely just the different C l

[issue31113] Stack overflow with large program

2017-08-04 Thread Stefan Behnel
Stefan Behnel added the comment: Regarding the user side of the problem, you might(!) be able to work around the crash by merging nested if-conditions into and-expressions if they have no elif/else. That's also why the split into multiple files doesn't help, it's the depth of

[issue31221] Tools/scripts/patchcheck.py must ignore changes in Modules/expat/ and Modules/zlib/ subdirectories

2017-08-17 Thread Stefan Krah
Stefan Krah added the comment: Yes, please add libmpdec to the ignored files. -- ___ Python tracker <http://bugs.python.org/issue31221> ___ ___ Python-bugs-list m

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-18 Thread Stefan Krah
Stefan Krah added the comment: Thanks. I tried to revert it, but got: remote: Resolving deltas: 100% (2/2), completed with 2 local objects. remote: error: GH006: Protected branch update failed for refs/heads/master. remote: error: 2 of 2 required status checks are expected. To https

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-18 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3166 ___ Python tracker <http://bugs.python.org/issue30923> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-18 Thread Stefan Krah
Stefan Krah added the comment: So I installed gcc-7.2.0 from source. Hilariously compiling gcc *itself* emits fallthrough warnings! Then I tried to be a good open source drone and add 20 /* fall through */ comments to libmpdec. gcc is too stupid to recognize the /* fall through */ at the

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-18 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3177 ___ Python tracker <http://bugs.python.org/issue30923> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-18 Thread Stefan Krah
Stefan Krah added the comment: New changeset d73a960c575207539c3f9765cff26d4fff400b45 by Stefan Krah in branch 'master': bpo-30923: Disable warning that has been part of -Wextra since gcc-7.0. (#3142) https://github.com/python/cpython/commit/d73a960c575207539c3f9765cff26d

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-19 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3194 ___ Python tracker <http://bugs.python.org/issue30923> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-19 Thread Stefan Krah
Stefan Krah added the comment: PR 3157 addresses everything apart from expat and https://github.com/python/cpython/blob/master/Modules/cjkcodecs/_codecs_iso2022.c#L816 I'm not sure about that one. It looks harmless but a bit odd. -- ___ P

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-21 Thread Stefan Krah
Stefan Krah added the comment: New changeset f432a3234f9f2ee09bd40be03e06bf72865ee375 by Stefan Krah in branch 'master': bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157) https://github.com/python/cpython/commit/f432a3234f9f2ee09bd40be03e06bf

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-21 Thread Stefan Krah
Stefan Krah added the comment: Cherry picking has too many conflicts, I'm not backporting this myself. -- ___ Python tracker <http://bugs.python.org/is

[issue26256] Fast decimalisation and conversion to other bases

2017-08-24 Thread Stefan Krah
Stefan Krah added the comment: pypy-5.8.0-beta0 (Python 3.5.3) is using a very nicely written CFFI wrapper for libmpdec, so it also has the fast bignums. -- ___ Python tracker <http://bugs.python.org/issue26

[issue26256] Fast decimalisation and conversion to other bases

2017-08-24 Thread Stefan Krah
Stefan Krah added the comment: What needs to be mentioned though is that the context has to be set for unrounded calculations: c = getcontext() c.prec = MAX_PREC c.Emax = MAX_EMAX c.Emin = MIN_EMIN Otherwise some people believe that the bignums are just rounded floating point arithmetic that

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-25 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3242 ___ Python tracker <http://bugs.python.org/issue30923> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-25 Thread Stefan Krah
Stefan Krah added the comment: New changeset 9e1e6f528f3fec16b9bd99f5ee38048ffec04a81 by Stefan Krah in branch 'master': bpo-30923: Silence fall-through warnings in libexpat build. (#3205) https://github.com/python/cpython/commit/9e1e6f528f3fec16b9bd99f5ee3804

[issue31275] Check fall-through in _codecs_iso2022.c

2017-08-25 Thread Stefan Krah
New submission from Stefan Krah: The last fall-through warning is in _codecs_iso2022.c. IMO the current code is equivalent to this, but I'm no codecs expert at all: diff --git a/Modules/cjkcodecs/_codecs_iso2022.c b/Modules/cjkcodecs/_codecs_iso2022.c index 1ce4218f30..abf214880f 100644

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-25 Thread Stefan Krah
Stefan Krah added the comment: All warnings except for #31275 are dealt with. -- resolution: -> fixed stage: -> resolved status: open -> closed type: -> compile error ___ Python tracker <http://bugs.python

[issue31275] Check fall-through in _codecs_iso2022.c

2017-08-25 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3243 ___ Python tracker <http://bugs.python.org/issue31275> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31275] Check fall-through in _codecs_iso2022.c

2017-08-25 Thread Stefan Krah
Stefan Krah added the comment: New changeset 138753c1b96b5e06a5c5d409fa4cae5e2fe1108b by Stefan Krah in branch 'master': bpo-31275: Small refactoring to silence a fall-through warning. (#3206) https://github.com/python/cpython/commit/138753c1b96b5e06a5c5d409fa4cae

[issue31275] Check fall-through in _codecs_iso2022.c

2017-08-25 Thread Stefan Krah
Stefan Krah added the comment: Thanks, Serhiy! -- components: +Build resolution: -> fixed stage: -> resolved status: open -> closed type: -> compile error versions: +Python 3.7 ___ Python tracker <http://bugs.python

[issue31279] Squash new gcc warning (-Wstringop-overflow)

2017-08-25 Thread Stefan Krah
New submission from Stefan Krah: gcc-7.2 emits the following not-so-useful warning: Objects/bytearrayobject.c:226:9: warning: ‘memcpy’: specified size between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 -- messages: 300851 nosy: skrah

[issue31279] Squash new gcc warning (-Wstringop-overflow)

2017-08-25 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3244 ___ Python tracker <http://bugs.python.org/issue31279> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31279] Squash new gcc warning (-Wstringop-overflow)

2017-08-25 Thread Stefan Krah
Stefan Krah added the comment: New changeset dce6502059f46a04f90938b9d832394c8215397b by Stefan Krah in branch 'master': bpo-31279: Silence -Wstringop-overflow warning. (#3207) https://github.com/python/cpython/commit/dce6502059f46a04f90938b9d83239

[issue31279] Squash new gcc warning (-Wstringop-overflow)

2017-08-25 Thread Stefan Krah
Changes by Stefan Krah : -- components: +Build resolution: -> fixed stage: -> resolved status: open -> closed type: -> compile error versions: +Python 3.7 ___ Python tracker <http://bugs.python

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-04 Thread Stefan Behnel
Changes by Stefan Behnel : -- pull_requests: +3322 ___ Python tracker <http://bugs.python.org/issue31336> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-04 Thread Stefan Behnel
New submission from Stefan Behnel: The method lookup fast path in _PyType_Lookup() does not apply during type creation, which is highly dominated by the performance of the dict lookups along the mro chain. Pre-calculating the name hash speeds up the creation of an empty class (i.e. "

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-04 Thread Stefan Behnel
Stefan Behnel added the comment: I literally just ran timeit on "class Test: pass", but I'll see if I can provide proper numbers. -- ___ Python tracker <http://bugs.pyt

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-04 Thread Stefan Behnel
Stefan Behnel added the comment: Comparing against CPython master as of 122e88a8354e3f75aeaf6211232dac88ac296d54 I rebuilt my CPython to get clean results, and that still gave me almost 15% overall speedup. Original: $ ./python -m timeit 'class Test: pass' 2 loops, best of 5:

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-04 Thread Stefan Behnel
Stefan Behnel added the comment: It's the slot names in "slotdefs". See "update_one_slot()". The time that is saved is mostly the overhead of calling PyDict_GetItem(). I actually tried PyDict_GetItemWithError() first, which is faster due to the lower error handling o

[issue31337] Small opportunity for NULL dereference in compile.c

2017-09-04 Thread Stefan Krah
Stefan Krah added the comment: I'm very much in favor of using abort() /* NOT REACHED */ in such cases. The only drawback is that in the case of libraries, sometimes distribution package lint tools complain. -- nosy: +skrah ___ Python tracker

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-04 Thread Stefan Behnel
Stefan Behnel added the comment: > I would prefer to use the _Py_IDENTIFIER API rather than using > _PyDict_GetItem_KnownHash(). Do you mean for the table of slot descriptions? I'm not sure that the effect would be comparable. > Maybe there are other opportunities for optimiza

[issue31338] Use abort() for code we never expect to hit

2017-09-04 Thread Stefan Krah
Stefan Krah added the comment: Regarding lint warnings, I may have confused abort() with exit(). Lintian has the shlib-calls-exit tag, somehow I thought there was a similar one for abort(), but I can't find it now. -- ___ Python tracker

[issue31333] Implement ABCMeta in C

2017-09-05 Thread Stefan Behnel
Stefan Behnel added the comment: Since the number of applications that get along without any file access is probably close to irrelevant, "os" and "io" feel like sufficiently widely used modules to merit being part of a "usual Python startup" benchmark. M

[issue31338] Use abort() for code we never expect to hit

2017-09-05 Thread Stefan Krah
Stefan Krah added the comment: > Is /* NOT REACHED */ a common convention? I think it's often used in BSD, I first saw it in OpenBSD. A macro is fine of course. -- ___ Python tracker <http://bugs.python.org

[issue31338] Use abort() for code we never expect to hit

2017-09-05 Thread Stefan Krah
Stefan Krah added the comment: And Solaris lint recognizes it: https://docs.oracle.com/cd/E60778_01/pdf/E60745.pdf Actually it could be that the convention comes right from K&R, but I can't find my copy right now. -- ___ Python track

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-05 Thread Stefan Behnel
Stefan Behnel added the comment: I updated the pull request with a split version of _PyType_Lookup() that bypasses the method cache during slot updates. I also ran the benchmarks with PGO enabled now to get realistic results. The overall gain is around 15%. Original: $ ./python -m timeit

[issue31338] Use abort() for code we never expect to hit

2017-09-05 Thread Stefan Krah
Stefan Krah added the comment: On Tue, Sep 05, 2017 at 05:10:24PM +, STINNER Victor wrote: > That's a good example of better implementation for Py_UNREACHABLE(). > > The tricky part is to make compiler warnings quiet. For example, you cannot > replace "abort(); ret

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-05 Thread Stefan Behnel
Stefan Behnel added the comment: Since I'm getting highly reproducible results on re-runs, I tend to trust these numbers. -- ___ Python tracker <http://bugs.python.org/is

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-05 Thread Stefan Behnel
Stefan Behnel added the comment: BTW, it seems that Yury's dict copy optimisation would also help here. When I use a benchmark scenario with a simple non-empty method/attribute dict (from Cython this time), almost 10% of the creation time is spent copying that dict, which should essent

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-06 Thread Stefan Behnel
Stefan Behnel added the comment: OTOH, if the created "module" is not a module object, then we could argue that the extension implementation is on its own with that case, and has to do its own re-execution safety checks. -- ___ Pyth

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-06 Thread Stefan Behnel
Stefan Behnel added the comment: Marcel proposed to disallow main-execution if the extension *might* return anything but a real object (not only if it actually does), but that seems excessive to me. The actual problem is that we consider it unsafe if the module is executed more than once

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-07 Thread Stefan Behnel
Stefan Behnel added the comment: I was kinda guessing that modifying the slot list wasn't a good idea. ;) My current use case is that I implement the "create" slot because it makes it very easy to intercept the spec and its configuration. It is not passed into "exec"

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-08 Thread Stefan Behnel
Stefan Behnel added the comment: I'm a bit torn on this. On the one hand, it's basically saying, "Cython is probably going to do it right anyway, so let's just assume it does". That's nice, and might be applicable to other cases as well. But that also feels li

[issue31403] Remove WITHOUT_THREADS from _decimal

2017-09-09 Thread Stefan Krah
Changes by Stefan Krah : -- assignee: skrah components: Extension Modules nosy: skrah priority: normal severity: normal status: open title: Remove WITHOUT_THREADS from _decimal type: behavior versions: Python 3.7 ___ Python tracker <ht

[issue31403] Remove WITHOUT_THREADS from _decimal

2017-09-09 Thread Stefan Krah
Changes by Stefan Krah : -- keywords: +patch pull_requests: +3466 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31403> ___ ___ Py

[issue31403] Remove WITHOUT_THREADS from _decimal

2017-09-09 Thread Stefan Krah
New submission from Stefan Krah: New changeset c0c29dff7940b7e7ecc1dd051080c5d5f9e42ba8 by Stefan Krah in branch 'master': bpo-31403: Remove WITHOUT_THREADS from _decimal. (#3474) https://github.com/python/cpython/commit/c0c29dff7940b7e7ecc1dd051080c5

[issue31403] Remove WITHOUT_THREADS from _decimal

2017-09-09 Thread Stefan Krah
Changes by Stefan Krah : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue31406] crashes when comparing between a Decimal object and a bad Rational object

2017-09-10 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3468 ___ Python tracker <https://bugs.python.org/issue31406> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31407] --without-pymalloc broken

2017-09-10 Thread Stefan Krah
New submission from Stefan Krah: ./configure --without-pymalloc produces: Objects/obmalloc.c: In function ‘bumpserialno’: Objects/obmalloc.c:1326:21: error: ‘struct _pymem_runtime_state’ has no member named ‘serialno’ ++_PyRuntime.mem.serialno; ^ Objects/obmalloc.c

[issue31408] Leak in typeobject.c

2017-09-10 Thread Stefan Krah
New submission from Stefan Krah: I traced this valgrind result down to 2ebc5ce42a8a9e047e790aefbf9a94811569b2b6 : ==23495== 240 (72 direct, 168 indirect) bytes in 1 blocks are definitely lost in loss record 2,255 of 2,922 ==23495==at 0x4C2A9A1: malloc (vg_replace_malloc.c:299) ==23495

[issue31406] crashes when comparing between a Decimal object and a bad Rational object

2017-09-10 Thread Stefan Krah
Stefan Krah added the comment: New changeset 3cedf46cdbeefc019f4a672c1104f3d5e94712bd by Stefan Krah in branch 'master': bpo-31406: Fix crash due to lack of type checking in subclassing. (#3477) https://github.com/python/cpython/commit/3cedf46cdbeefc019f4a672c1104f3

[issue31406] crashes when comparing between a Decimal object and a bad Rational object

2017-09-10 Thread Stefan Krah
Stefan Krah added the comment: New changeset f8909d0e4b652256e4da153fa6be664490f60a07 by Stefan Krah (Miss Islington (bot)) in branch '3.6': [3.6] bpo-31406: Fix crash due to lack of type checking in subclassing. (GH-3477) (#3479) https://github.com/python/cpyt

[issue31406] crashes when comparing between a Decimal object and a bad Rational object

2017-09-10 Thread Stefan Krah
Stefan Krah added the comment: Thanks for the report and the patch! -- resolution: -> fixed versions: +Python 3.6 ___ Python tracker <https://bugs.python.org/issu

[issue31406] crashes when comparing between a Decimal object and a bad Rational object

2017-09-10 Thread Stefan Krah
Changes by Stefan Krah : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue31406> ___ ___ Pyth

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-10 Thread Stefan Behnel
Stefan Behnel added the comment: Any more comments on the proposed implementation? 13-15% seem worth it to me. @Victor, or are you saying "PyId, or no change at all"? -- ___ Python tracker <https://bugs.python.o

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-10 Thread Stefan Behnel
Stefan Behnel added the comment: No, that one was addressed. I think only Victor's comment is still open, that's why I asked back. -- ___ Python tracker <https://bugs.python.o

[issue31420] Reference leaks introduced by bpo-30860

2017-09-11 Thread Stefan Krah
Stefan Krah added the comment: Could be the same as #31408. -- nosy: +skrah ___ Python tracker <https://bugs.python.org/issue31420> ___ ___ Python-bugs-list mailin

[issue31408] Leak in typeobject.c

2017-09-12 Thread Stefan Krah
Stefan Krah added the comment: It's fixed, thanks! -- resolution: -> duplicate stage: needs patch -> resolved status: open -> closed superseder: -> Reference leaks introduced by bpo-30860 ___ Python tracker <https://bugs.p

[issue31435] Addition giving incorrect result in certain circumstances

2017-09-12 Thread Stefan Krah
Stefan Krah added the comment: Pythons has binary floating point, which does not give the same results as a pocket calculator. You can see the differences by using the decimal module: # These are the binary floats in exact decimal representation. >>> Decimal(7.95

[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-09-13 Thread Stefan Behnel
New submission from Stefan Behnel: The "XMLParser.__init__()" method in "_elementtree.c" contains this code: self->handle_start = PyObject_GetAttrString(target, "start"); self->handle_data = PyObject_GetAttrString(target, "data"); se

[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-09-13 Thread Stefan Behnel
Changes by Stefan Behnel : -- keywords: +patch pull_requests: +3542 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31455> ___ ___ Py

[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: Feel free to provide a separate pull request. These issues seem independent of the exception handling problem that I wrote a fix for. -- ___ Python tracker <https://bugs.python.org/issue31

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: > Is it correct to call _PyType_Lookup() with an exception set? The general rule of thumb is that it's not safe to call any user code with a live exception set, and lookups can call into user code. I quickly looked through all occurrences (there are

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-09-14 Thread Stefan Behnel
New submission from Stefan Behnel: Follow-up to issue 31336: The fact that _PyType_Lookup() does not propagate exceptions leaves some space for ambiguity. If, in a chain of MRO lookups, one would fail and a later one would succeed, is it correct to keep trying? What if the first failure

[issue31336] Speed up _PyType_Lookup() for class creation

2017-09-14 Thread Stefan Behnel
Stefan Behnel added the comment: One more thing: the fact that the lookup does not propagate exceptions leaves some space for ambiguity. If, in a chain of MRO lookups, one would fail and a later one would succeed, is it correct to keep trying? What if the first failure actually failed to see

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-09-14 Thread Stefan Behnel
Stefan Behnel added the comment: I'm working on a PR for this, but after changing all usages and fixing up some error handling here and there, it results in an interpreter crash for me. I'll try to debug it during the next days. -- nosy: +pitrou, serhiy

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-09-16 Thread Stefan Behnel
Changes by Stefan Behnel : -- keywords: +patch pull_requests: +3607 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31465> ___ ___ Py

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-09-16 Thread Stefan Behnel
Stefan Behnel added the comment: Test suite passes now. The crash was due to an uninitialised error flag in one case, which lead the C compiler to do incorrect optimisations on undefined behaviour. -- ___ Python tracker <https://bugs.python.

[issue31443] Possibly out of date C extension documentation

2017-09-17 Thread Stefan Krah
Stefan Krah added the comment: PyType_GenericNew() should be in libpython, so indeed the example in the docs seems a bit odd to me. -- nosy: +skrah ___ Python tracker <https://bugs.python.org/issue31

[issue31499] ElementTree crash with new expat

2017-09-17 Thread Stefan Behnel
New submission from Stefan Behnel: I'm seeing crashes in the latest Py3.7 when I run this test (taken from lxml's compatibility test suite): etree = xml.etree.ElementTree def test_feed_parser_error_position(self): ParseError = etree.ParseError parser =

[issue31499] ElementTree crash with new expat

2017-09-17 Thread Stefan Behnel
Stefan Behnel added the comment: Sorry, wrong line number. Was using an installed Py3.7, not a fresh build. However, my crashing installed version is from September 1st, *before* the expat update, which was apparently on September 5th. With a clean debug build, I get a reproducible crash

[issue31499] ElementTree crash while cleaning up ParseError

2017-09-17 Thread Stefan Behnel
Stefan Behnel added the comment: Minimal reproducer seems to be this: -- import xml.etree.ElementTree as etree def test(): parser = etree.XMLParser() try: parser.close() except etree.ParseError as exc: e = exc # must keep local reference! test

[issue31443] Possibly out of date C extension documentation

2017-09-17 Thread Stefan Krah
Stefan Krah added the comment: FWIW, I've been using https://github.com/python/cpython/blob/master/Modules/_decimal/_decimal.c#L689 the static initialization on problematic platforms like Windows and AIX for years, without any problems. I'm sure this is valid C, and people

[issue31443] Possibly out of date C extension documentation

2017-09-17 Thread Stefan Krah
Stefan Krah added the comment: Christian, do you remember which compiler was the reason for the commit cbf3b5cb76906fba15dbf59a1e83c540a447b907 ? + /* Due to cross platform compiler issues the slots must be filled +* here. It's required for portability to Windows wi

[issue31499] ElementTree crash while cleaning up ParseError

2017-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks for confirming, Victor. I hadn't realised that the first update of expat was already back in June. That means it's not ruled out yet as a source of this crash. Bisecting is probably a good idea. --

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: Question: Do you think it's ok to change the signature of _PyType_Lookup() in this way by adding an error flag, or should I add a new function instead? There is no performance difference to PR 3279 since gcc should optimise this flag properly away in

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-09-18 Thread Stefan Behnel
Changes by Stefan Behnel : -- pull_requests: +3632 ___ Python tracker <https://bugs.python.org/issue31465> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31499] ElementTree crash while cleaning up ParseError

2017-09-18 Thread Stefan Behnel
Stefan Behnel added the comment: > The question is more why/how the code didn't crash before? :-) Typical case of a Schroedinbug. -- ___ Python tracker <https://bugs.python.org

[issue31443] Possibly out of date C extension documentation

2017-09-20 Thread Stefan Krah
Stefan Krah added the comment: Thanks, Christian. -- I found that in the docs the culprit is Cygwin: db6a569de7ae595ada53b618fce6bbbd1c98d350 -- ___ Python tracker <https://bugs.python.org/issue31

[issue31443] Possibly out of date C extension documentation

2017-09-20 Thread Stefan Krah
Stefan Krah added the comment: I've just asked on python-dev if Cygwin is still broken. Not sure if we support it. -- ___ Python tracker <https://bugs.python.org/is

[issue31443] Possibly out of date C extension documentation

2017-09-21 Thread Stefan Krah
Changes by Stefan Krah : -- keywords: +patch pull_requests: +3678 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31443> ___ ___ Py

[issue31443] Possibly out of date C extension documentation

2017-09-21 Thread Stefan Krah
Stefan Krah added the comment: Erik, if you are interested in Cygwin, could you please check that xxmodule.c builds on Cygwin with the patch? You need to uncomment a couple of lines in setup.py to build 'xx'. -- ___ Python track

[issue31443] Possibly out of date C extension documentation

2017-09-21 Thread Stefan Krah
Stefan Krah added the comment: In fact, building _decimal should also fail on Cygwin if this were still an issue. -- ___ Python tracker <https://bugs.python.org/issue31

[issue31443] Possibly out of date C extension documentation

2017-09-22 Thread Stefan Krah
Stefan Krah added the comment: Okay, thanks. I found that bz2module.c has also used direct initialization for ages. I'm going to commit the change. -- ___ Python tracker <https://bugs.python.org/is

<    12   13   14   15   16   17   18   19   20   21   >