[issue37764] email.Message.as_string infinite loop

2019-08-15 Thread Abhilash Raj
Abhilash Raj added the comment: I meant, =aa is identified as encoded word escape -- ___ Python tracker ___ ___ Python-bugs-list

[issue37764] email.Message.as_string infinite loop

2019-08-15 Thread Abhilash Raj
Abhilash Raj added the comment: You have correctly identified that "=aa" is detected as a encoded word and causes the get_encoded_word to fail. However, "=?utf-8?q?somevalue?=aa" should ideally get parsed as "somevalueaa" and not "=?utf-8?q?somevalue?=aa". This is because

[issue37824] IDLE: Handle Shell input warnings properly.

2019-08-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: I am combining the trivial 'leave Shell input SyntaxWarnings alone (instead of making them SyntaxErrors)' part of #34857 with this issue, 'print Shell input (and the very rare internal IDLE Warnings occurring after Shell exists) in Shell, and changing the

[issue37824] IDLE: Handle Shell input warnings properly.

2019-08-15 Thread Terry J. Reedy
Change by Terry J. Reedy : -- keywords: +patch pull_requests: +15030 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15311 ___ Python tracker ___

[issue34857] IDLE: Module warnings misplaced.

2019-08-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: I moved leaving SyntaxWarnings as warnings to #37824, as that is mostly about editing pyshell. Changing the ordering of warnings and RESTART involves run.show_warnings. I believe the latter should collect lines in a warnings list and print

[issue37824] IDLE: Handle Shell input warnings properly.

2019-08-15 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +rhettinger, taleinat title: IDLE: DeprecationWarning not handled properly -> IDLE: Handle Shell input warnings properly. ___ Python tracker

[issue37871] 40 * 473 grid of "é" has a single wrong character on Windows

2019-08-15 Thread Eryk Sun
Eryk Sun added the comment: To be compatible with Windows 7, _io__WindowsConsoleIO_write_impl in Modules/_io/winconsoleio.c is forced to write to the console in chunks that do not exceed 32 KiB. It does so by repeatedly dividing the length to decode by 2 until the decoded buffer size is

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: There's likely more that could be done -- I've just taken the low hanging fruit. If someone wants to re-open this and go farther, please take it from here. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset f3cb68f2e4c3e0c405460f9bb881f5c1db70f535 by Raymond Hettinger in branch 'master': bpo-37863: Optimize Fraction.__hash__() (#15298) https://github.com/python/cpython/commit/f3cb68f2e4c3e0c405460f9bb881f5c1db70f535 --

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Eryk Sun
Eryk Sun added the comment: > So for an actual non-root mount point ntpath.ismount() returns True > and with IO_REPARSE_TAG_MOUNT_POINT included ntpath.islink() also > returns True. nt.readlink() returns the "\\?\Volume{GUID}\" path If islink() is true, then st_mode has S_IFLNK and not

[issue17305] IDNA2008 encoding is missing

2019-08-15 Thread Ashwin Ramaswami
Ashwin Ramaswami added the comment: So is the consensus that the best way to do this is to move the "idna" library to stdlib, or implement it from scratch? -- ___ Python tracker

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Eryk Sun
Eryk Sun added the comment: > # Always make the OS resolve "unknown" reparse points >ALLOWED_TO_TRAVERSE = {SYMLINK, MOUNT_POINT} >if !traverse and st.reparse_tag not in ALLOWED_TO_TRAVERSE: >return xstat(path, !traverse) To me the naming here makes sense as

[issue33007] Objects referencing private-mangled names do not roundtrip properly under pickling.

2019-08-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: This problem is specific to private methods AFAICT, since they're the only things which have an unmangled __name__ used to pickle them, but are stored as a mangled name. More details on cause and solution on issue #37852, which I closed as a duplicate of

[issue37871] 40 * 473 grid of "é" has a single wrong character on Windows

2019-08-15 Thread ANdy
New submission from ANdy : # To reproduce: # Put this text in a file `a.py` and run `py a.py`. # Or just run: py -c "print(('é' * 40 + '\n') * 473)" # Scroll up for a while. One of the lines will be: # ��ééé # (You can spot this because it's slightly longer

[issue37852] Pickling doesn't work for name-mangled private methods

2019-08-15 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Objects referencing private-mangled names do not roundtrip properly under pickling. ___ Python tracker

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Tim Peters
Tim Peters added the comment: Mark, I did just a little browsing on this. It seems it's well known that egcd beats straightforward exponentiation for this purpose in arbitrary precision contexts, for reasons already sketched (egcd needs narrower arithmetic from the start, benefits from the

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Eryk Sun
Eryk Sun added the comment: > It also has a bug that a drive root is a mount point, even if the > drive doesn't exist. Also, it's wrong in not checking for junctions > in UNC paths. SMB supports opening reparse points over the wire. "It" in the above sentences is ntpath.ismount, not

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Eryk Sun
Eryk Sun added the comment: > Okay, I get it now. So we _do_ want to "upgrade" lstat() to stat() > when it's not a symlink. I don't see that as a behavior upgrade. It's just an implementation detail. lstat() is still following its mandate to not follow symlinks -- however you ultimately

[issue37870] os.path.ismount returns false for disconnected CIFS mounts in Linux

2019-08-15 Thread Matt Christopher
New submission from Matt Christopher : I've got a case where we mount a CIFS filesystem and then later the actual backing filesystem is deleted (but the mount remains on the machine). When running from a shell, this is the behavior which I see after the backing CIFS filesystem has gone away:

[issue37868] `is_dataclass` returns `True` if `getattr` always succeeds.

2019-08-15 Thread Eric V. Smith
Eric V. Smith added the comment: Yeah, I agree it's not an awesome design to work with classes or instances, but it's documented that way. As soon as I write some tests I'll check this in. -- ___ Python tracker

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Steve Dower
Steve Dower added the comment: So for an actual non-root mount point, ntpath.ismount() returns True and with IO_REPARSE_TAG_MOUNT_POINT included ntpath.islink() also returns True. nt.readlink() returns the "\\?\Volume{GUID}\" path Root mount points ("C:\\", etc.) do not return true for

[issue37587] JSON loads performance improvement for long strings

2019-08-15 Thread Marco Paolini
Marco Paolini added the comment: ujson (https://github.com/esnme/ultrajson) instead is faster when decoding non-ascii in the same example above, so it is likely there is room for improvement... -- ___ Python tracker

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Steve Dower
Steve Dower added the comment: > So we _do_ want to "upgrade" lstat() to stat() when it's not a symlink. Except this bug came about because we want to _downgrade_ stat() to lstat() when it's an appexeclink, because the whole point of those is to use them without following them (and yeah,

[issue29535] datetime hash is deterministic in some cases

2019-08-15 Thread Ashwin Ramaswami
Ashwin Ramaswami added the comment: > Making the numeric hash non-predictable while maintaining its current > properties would be difficult. Why so? > In fact, I think it's reasonable to assume that there are no websites > vulnerable to a DOS via *numeric* hash collisions until we see

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Steve Dower
Steve Dower added the comment: > For example, if we've opened an HSM reparse point, we must reopen to let > the file-system filter driver implement its semantics to replace the > reparse point with the real file from auxiliary storage and complete the > request. That is the stat() result I

[issue37587] JSON loads performance improvement for long strings

2019-08-15 Thread Marco Paolini
Marco Paolini added the comment: ops sorry here's the right commands python -m pyperf timeit -s 'import json;' -s 'c = "a"; s = json.dumps(c * (2**10 // (len(json.dumps(c)) - 2)))' 'json.loads(s)' -o ascii2k.json python -m pyperf timeit -s 'import json;' -s 'c = "€"; s = json.dumps(c *

[issue37587] JSON loads performance improvement for long strings

2019-08-15 Thread Marco Paolini
Marco Paolini added the comment: also worth noting escape sequences for non-ascii characters are slower, even when encoded length is the same. python -m pyperf timeit -s 'import json;' -s 'c = "€"; s = json.dumps(c * (2**10 // len(json.dumps(c)) - 2))' 'json.loads(s)' -o nonascii2k.json

[issue37869] Compilation warning on GCC version 7.4.0-1ubuntu1~18.04.1

2019-08-15 Thread Hansraj Das
New submission from Hansraj Das : I am facing below compilation warning on compilation python source: *** gcc -pthread -c -Wno-unused-result -Wsign-compare -g -Og -Wall-std=c99 -Wextra -Wno-unused-result

[issue37587] JSON loads performance improvement for long strings

2019-08-15 Thread Marco Paolini
Marco Paolini added the comment: I also confirm Inada's patch further improves performance! All my previous benchmarks were done with gcc and PGO optimizations performed only with test_json task... maybe this explains the weird results? I tested the performance of new master

[issue20490] Show clear error message on circular import

2019-08-15 Thread Anthony Sottile
Change by Anthony Sottile : -- nosy: +Anthony Sottile versions: +Python 3.8, Python 3.9 -Python 3.5 ___ Python tracker ___ ___

[issue37868] `is_dataclass` returns `True` if `getattr` always succeeds.

2019-08-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am not sure that it is good idea to accept a type and an instance, but if it is a goal, is_dataclass() should be defined as: def is_dataclass(obj): cls = obj if isinstance(obj, type) else type(obj) return hasattr(cls, _FIELDS)

[issue20490] Show clear error message on circular import

2019-08-15 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +15028 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15308 ___ Python tracker ___

[issue37868] `is_dataclass` returns `True` if `getattr` always succeeds.

2019-08-15 Thread Eric V. Smith
Eric V. Smith added the comment: I'm guessing I'm looking up the attribute on the instance, not the class. -- ___ Python tracker ___

[issue37866] PyModule_GetState Segmentation fault when called Py_Initialize

2019-08-15 Thread Joannah Nanjekye
Change by Joannah Nanjekye : -- nosy: +eric.snow, ncoghlan, vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue34155] email.utils.parseaddr mistakenly parse an email

2019-08-15 Thread Abhilash Raj
Abhilash Raj added the comment: @Victor: This is already backported to 3.6. I am not sure about what gets backported to 3.5 right now, I don't even see a 'Backport to 3.5' label on Github (which made me think we are discouraged to backport to 3.5). I can work on a manual backport if needed?

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Tim Peters
Tim Peters added the comment: Well, details matter ;-) Division in Python is expensive. In the exponentiation algorithm each reduction (in general) requires a 122-by-61 bit division. In egcd, after it gets going nothing exceeds 61 bits, and across iterations the inputs to the division

[issue37642] timezone allows no offset from range (23:59, 24:00)

2019-08-15 Thread Paul Ganssle
Change by Paul Ganssle : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Eryk Sun
Eryk Sun added the comment: > Unless your point is that we should _always_ traverse junctions? In > which case we have a traverse 'upgrade' scenario (calls to lstat() > become calls to stat() when we find out it's a junction). If we've opened the reparse point to test

[issue37642] timezone allows no offset from range (23:59, 24:00)

2019-08-15 Thread Paul Ganssle
Paul Ganssle added the comment: New changeset ed44b84961eb0e5b97e4866c1455ac4093d27549 by Paul Ganssle in branch '3.7': bpo-37642: Update acceptable offsets in timezone (GH-14878) (#15226) https://github.com/python/cpython/commit/ed44b84961eb0e5b97e4866c1455ac4093d27549 --

[issue37642] timezone allows no offset from range (23:59, 24:00)

2019-08-15 Thread Paul Ganssle
Paul Ganssle added the comment: New changeset 27b38b99b3a154fa5c25cd67fe01fb4fc04604b0 by Paul Ganssle in branch '3.8': bpo-37642: Update acceptable offsets in timezone (GH-14878) (#15227) https://github.com/python/cpython/commit/27b38b99b3a154fa5c25cd67fe01fb4fc04604b0 --

[issue37790] subprocess.Popen() is extremely slow

2019-08-15 Thread John Levon
Change by John Levon : -- nosy: +movement ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > Indeed, I bet it would pay in `long_pow()` to add another test, under the `if > (Py_SIZE(b) < 0)` branch, to skip the exponentiation part entirely when b is > -1. Agreed. -- ___ Python tracker

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > That's a major difference between exponents of bit lengths 61 > ((P-2).bit_length()) and 1 ((1).bit_length()). Right, but that's stacked up against the cost of the extended Euclidean algorithm for computing the inverse. The extended gcd for computing the

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Steve Dower
Steve Dower added the comment: Unless your point is that we should _always_ traverse junctions? In which case we have a traverse 'upgrade' scenario (calls to lstat() become calls to stat() when we find out it's a junction). Again, not sure why we'd want to hide the ability to manipulate the

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Steve Dower
Steve Dower added the comment: [Quoting from the PR comments] > traverse is from follow_symlinks and only applies to symlinks. It does not > apply to other types of reparse points. I get your argument that junctions are not symlinks, but I disagree that we should try this hard to emulate

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Tim Peters
Tim Peters added the comment: Why I expected a major speedup from this: the binary exponentiation routine (for "reasonably small" exponents) does 30 * ceiling(exponent.bit_length() / 30) multiply-and-reduces, plus another for each bit set in the exponent. That's a major difference between

[issue37863] Speed up hash(fractions.Fraction)

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > Should be significantly faster. If not, the new "-1" implementation should > be changed ;-) I wouldn't have bet on this, before seeing Raymond's benchmark results. Writing a fast path for invmod for C-size integers is still on my to-do list; the current

[issue37860] Add netlify deploy preview for docs

2019-08-15 Thread Brett Cannon
Change by Brett Cannon : -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2019-08-15 Thread miss-islington
miss-islington added the comment: New changeset 37806f404f57b234902f0c8de9a04647ad01b7f1 by Miss Islington (bot) (Jeroen Demeyer) in branch 'master': bpo-37207: enable vectorcall for type.__call__ (GH-14588) https://github.com/python/cpython/commit/37806f404f57b234902f0c8de9a04647ad01b7f1

[issue37834] readlink on Windows cannot read app exec links

2019-08-15 Thread Steve Dower
Steve Dower added the comment: > I assume you're talking about realpath() here ... Yes, and so are you :) Let's move that discussion to issue9949 and/or PR 15287. > I think os.chdir should raise an exception when passed a device path. When the OS starts returning an error code for this

[issue37645] Replace PyEval_GetFuncName/PyEval_GetFuncDesc

2019-08-15 Thread Petr Viktorin
Petr Viktorin added the comment: I am not convinced. I'm wary of making error messages depend on the str representation of a function; that would prevent us from changing it later. I'm wary of "%S" used in error messages. Those are for the programmer, not the user, so they should prefer

[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread simon mackenzie
simon mackenzie added the comment: Would be clearer if the arguments were listed before the return object. On Thu, 15 Aug 2019 at 15:05, SilentGhost wrote: > > SilentGhost added the comment: > > But docs don't say that at all. You're looking at description of an > attribute of returned

[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread SilentGhost
SilentGhost added the comment: But docs don't say that at all. You're looking at description of an attribute of returned object. And of course it can be a string, under certain conditions. The attributes of CompletedProcess and function arguments are described in the standard way, and I

[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread simon mackenzie
simon mackenzie added the comment: Technically true but I am not the first person to have incorrectly interpreted this that it can be a string which suggests it is not clear to the reader. Maybe should be explicitly stated in the description of run as it is not obvious or intuitive. On Thu,

[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread SilentGhost
SilentGhost added the comment: The only place this phrase appears is in CompletedProcess.args description and it is correct there. Whether args arguments of subprocess.run (or generally Popen) can be a list or a string is discussed in Frequently Used Arguments section, and it is perfectly

[issue37868] `is_dataclass` returns `True` if `getattr` always succeeds.

2019-08-15 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue37868] `is_dataclass` returns `True` if `getattr` always succeeds.

2019-08-15 Thread Johan Hidding
New submission from Johan Hidding : Given a class `A` that overloads `__getattr__` ``` class A: def __getattr__(self, key): return 0 ``` An instance of this class is always identified as a dataclass. ``` from dataclasses import is_dataclass a = A() print(is_dataclass(a)) ``` gives

[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +gregory.p.smith ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue29535] datetime hash is deterministic in some cases

2019-08-15 Thread Mark Dickinson
Mark Dickinson added the comment: > shouldn't numerics, datetime objects, and tuples be non-deterministically > hashed as well? [...] Making the numeric hash non-predictable while maintaining its current properties would be difficult. But fortunately, I don't think it's necessary. IIUC,

[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread simon mackenzie
New submission from simon mackenzie : The docs for subprocess.run say "The arguments used to launch the process. This may be a list or a string." This works in windows but in linux it has to be a list. Either needs fixing or the docs need to be changed. -- messages: 349800 nosy:

[issue21131] test_faulthandler.test_register_chain fails on 64bit ppc/arm with kernel >= 3.10

2019-08-15 Thread Peter Edwards
Peter Edwards added the comment: On Wed, 14 Aug 2019 at 23:13, STINNER Victor wrote: > > STINNER Victor added the comment: > > About PR 13649, I'm not sure that _PyThread_preferred_stacksize() is still > relevant, since my change fixed test_faulthandler test_register_chain(). I > chose my

[issue21131] test_faulthandler.test_register_chain fails on 64bit ppc/arm with kernel >= 3.10

2019-08-15 Thread Peter Edwards
Peter Edwards added the comment: On Wed, 14 Aug 2019 at 22:32, STINNER Victor wrote: > > We are talking abou the faulthandler_user() function of > Modules/faulthandler.c. It is implemented in pure C, it doesn't allocate > memory on the heap, it uses a very small set of functions (write(), >

[issue37866] PyModule_GetState Segmentation fault when called Py_Initialize

2019-08-15 Thread Hua Liu
New submission from Hua Liu : the crash file came out when i tried to call Py_Initialize in a C file. Python2.7 and python3.5.3 were installed to my x86-64 box. -- ___ Python tracker

[issue21131] test_faulthandler.test_register_chain fails on 64bit ppc/arm with kernel >= 3.10

2019-08-15 Thread Peter Edwards
Peter Edwards added the comment: On Wed, 14 Aug 2019 at 22:34, STINNER Victor wrote: > > ...I'm not sure that we can fix bpo-37851 in Python 3.7. That's totally reasonable, sure. -- ___ Python tracker

[issue37866] PyModule_GetState Segmentation fault when called Py_Initialize

2019-08-15 Thread Hua Liu
Change by Hua Liu : Added file: https://bugs.python.org/file48545/backtrace.txt ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue37866] PyModule_GetState Segmentation fault when called Py_Initialize

2019-08-15 Thread Hua Liu
Change by Hua Liu : -- nosy: Hua Liu priority: normal severity: normal status: open title: PyModule_GetState Segmentation fault when called Py_Initialize type: crash versions: Python 3.5 ___ Python tracker

[issue37865] tempfile.NamedTemporaryFile() raises exception on close() when file is absent

2019-08-15 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I think this is same as https://bugs.python.org/issue29573 . -- nosy: +xtreak ___ Python tracker ___

[issue37865] tempfile.NamedTemporaryFile() raises exception on close() when file is absent

2019-08-15 Thread Andrei Pashkin
New submission from Andrei Pashkin : Here is an example: import tempfile import os with tempfile.NamedTemporaryFile() as temp: os.remove(temp.name) And here is an error it produces: Traceback (most recent call last): File "test.py", line 6, in os.remove(temp.name) File

[issue36753] Python modules not linking to libpython causes issues for RTLD_LOCAL system-wide

2019-08-15 Thread Antal Nemes
Change by Antal Nemes : -- nosy: +furiel ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37852] Pickling doesn't work for name-mangled private methods

2019-08-15 Thread Zackery Spytz
Zackery Spytz added the comment: This seems like a duplicate of bpo-33007. -- nosy: +ZackerySpytz ___ Python tracker ___ ___