[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

2021-01-15 Thread hai shi
hai shi added the comment: >Not a function, shouldn't be used with PyType_Slot: > * tp_dict - I'd add a PyType_GetDict if there is a need to get this > * tp_mro - I'd add a PyType_GetMRO if there is a need to get this I checked some other projects which use type fileds directly. cpython

[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-15 Thread William Pickard
William Pickard added the comment: Jumping in here to explain why '__class' doesn't crash when '__sizeof__' does: When '__class__' is fetched, it returns a new reference to the object's type. When '__sizeof__' is fetched on the otherhand, a new object is allocated on the heap

[issue37006] Add top level await statement support for doctest

2021-01-15 Thread Austin "Paco" Rainwater
Change by Austin "Paco" Rainwater : -- nosy: +pacorain ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42889] Incorrect behavior after ast node visits

2021-01-15 Thread Xinmeng Xia
Xinmeng Xia added the comment: Thank you for your kindly explanations! The output of the first program in msg384799 behaves as expected from the view of AST compiling. Yes,I see now. But for the second example in msg384879, the behaviors are inconsistent between old Python

[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-15 Thread Xinmeng Xia
Xinmeng Xia added the comment: Thank you. But I am not sure this is a recursion problem. Please see the following example, I replace "__sizeof__" with "__class__". No segmentation fault. Everything goes well. mystr = "hello123" print(dir(mystr)) for x in

[issue42916] Support for DICOM image file format in imghdr module

2021-01-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: Can you submit a patch, or post here an test_dicom function? -- nosy: +terry.reedy stage: -> needs patch ___ Python tracker ___

[issue42935] Pickle can't import builtins at exit

2021-01-15 Thread Guido van Rossum
Guido van Rossum added the comment: I don’t know there is much we can do about this. I recommend using ‘with’ to close the shelf earlier. -- nosy: +gvanrossum ___ Python tracker

[issue42889] Incorrect behavior after ast node visits

2021-01-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: The parser is not involved here. The transformed code is *not* equivalent to "1=2; print(1)" because you replace 'a' with the string '1', not the int 1. The result is to transform "globals()['a']=2; print(globals()['a'])" to "globals()['1']=2;

[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: Xinmeng, to verify Ronald's explanation, run this instead mystr = "hello123" for x in range(100): mystr = mystr.__sizeof__() input('>') # Hit Enter to continue. del mystr # Expect crash here. input('<') # And never get here. -- nosy:

[issue42888] Not installed “libgcc_s.so.1” causes exit crash.

2021-01-15 Thread Terry J. Reedy
Change by Terry J. Reedy : -- components: +C API -Interpreter Core title: Not installed “libgcc_s.so.1” causes parser crash. -> Not installed “libgcc_s.so.1” causes exit crash. ___ Python tracker

[issue42937] 192.0.0.8 (IPv4 dummy address) considered globally reachable

2021-01-15 Thread CDirkx
New submission from CDirkx : Currently the method `ipaddress.is_global` returns true for the IPv4 address 192.0.0.8. This was correct when `is_global` was initially implemented, but in 2015 192.0.0.8 got designated as the "IPv4 dummy address" and not globally reachable, see the IANA special

[issue42885] Regex performance problem with ^ aka AT_BEGINNING

2021-01-15 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42849] pool worker can't be terminated

2021-01-15 Thread ppperry
ppperry added the comment: duplicate of issue22393? -- nosy: +ppperry ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42917] Block stack size for frame objects should be dynamically sizable

2021-01-15 Thread Thomas Anderson
Thomas Anderson added the comment: > Reducing the size of the frame object seems like a worthwhile goal, but > what's the point in increasing the maximum block stack? No point for humans, but it may be useful for code generators. -- ___ Python

[issue42927] Inline cache for slots

2021-01-15 Thread Guido van Rossum
Guido van Rossum added the comment: I created a benchmark for this, see https://github.com/python/pyperformance/pull/86. Next I'll add a blurb and then it's off to reviewers. -- ___ Python tracker

[issue42931] Include randbytes in random.__all__

2021-01-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 17c1f0c8cb96637c36548edf6e4570ac7564004b by Miss Islington (bot) in branch '3.9': bpo-42931: randbytes missing from random.__all__ (GH-24219) (GH-24225) https://github.com/python/cpython/commit/17c1f0c8cb96637c36548edf6e4570ac7564004b

[issue42931] Include randbytes in random.__all__

2021-01-15 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42931] Include randbytes in random.__all__

2021-01-15 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 3.0 -> 4.0 pull_requests: +23049 pull_request: https://github.com/python/cpython/pull/24225 ___ Python tracker

[issue42931] Include randbytes in random.__all__

2021-01-15 Thread Raymond Hettinger
New submission from Raymond Hettinger : New changeset 998ae1fa3fb05a790071217cf8f6ae3a928da13f by Setrak Balian in branch 'master': bpo-42931: randbytes missing from random.__all__ (GH-24219) https://github.com/python/cpython/commit/998ae1fa3fb05a790071217cf8f6ae3a928da13f --

[issue42911] Addition chains for pow saves 5-20% time for pow(int, int)

2021-01-15 Thread Mark Dickinson
Mark Dickinson added the comment: Thank you for the proposal and PR! There are some tradeoffs to be considered here, between simplicity and performance; it's not always trivial to find the sweet spot. Python's int implementation mostly favours the simplicity end of the spectrum. It's also

[issue42917] Block stack size for frame objects should be dynamically sizable

2021-01-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Getting rid of hardcoded limits is good. And at first look the proposed PR looks good (some minor details can be discussed). Although there is different approach to solve the same problem. The stack of blocks is used to set handlers for exceptions. For

[issue42377] allow typing.cast with TYPE_CHECKING

2021-01-15 Thread Ken Jin
Ken Jin added the comment: Sorry, I don't think this is a typing module issue. The NameError stems from what you mentioned: 'A' not being defined since TYPE_CHECKING evaluates to false at runtime. This would raise an error in any Python code, not just typing. The equivalent is this:: >>> A

[issue42911] Addition chains for pow saves 5-20% time for pow(int, int)

2021-01-15 Thread Jurjen N.E. Bos
Change by Jurjen N.E. Bos : -- title: Addition chains for pow saves 10 % time! -> Addition chains for pow saves 5-20% time for pow(int,int) ___ Python tracker ___

[issue42911] Addition chains for pow saves 10 % time!

2021-01-15 Thread Jurjen N.E. Bos
Jurjen N.E. Bos added the comment: Well, measurements show that it saves more time than I thought (sometimes over 20%!), because there are other ways in which it saves time; I am quite happy with that. In the code I needed functions _Py_bit_length64 and _Py_bit_count64. I thought these

[issue41824] Docs for typing.ForwardRef don't state that it was added in 3.7

2021-01-15 Thread Ken Jin
Change by Ken Jin : -- keywords: +patch nosy: +kj nosy_count: 2.0 -> 3.0 pull_requests: +23048 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24224 ___ Python tracker

[issue42936] Decimal module performs wrong floor division with negative numbers

2021-01-15 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the report. I'm going to close here, since this isn't a bug. If you want to advocate for a behaviour change, by all means go ahead, but be aware that it would likely be a hard sell. The main challenge would be finding a way to change the

[issue42929] On Windows, shutil.move doesn't raise FileExistsError if dst exists like os.rename

2021-01-15 Thread Eryk Sun
Eryk Sun added the comment: I can help, but in this case there isn't much to do. Just replace os.rename() with os.replace(), make a minor doc change, and maybe add a test that ensures a junction can be moved over an existing file on the same filesystem. For example: >>> os.mkdir('temp')

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset ba876c44a8d06668e622fb580fdcde45c7a36d48 by Irit Katriel in branch 'master': bpo-42934: use TracebackException(compact=True) in unittest.TestResult (GH-24221) https://github.com/python/cpython/commit/ba876c44a8d06668e622fb580fdcde45c7a36d48

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Guido van Rossum
Change by Guido van Rossum : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42936] Decimal module performs wrong floor division with negative numbers

2021-01-15 Thread Mark Dickinson
Mark Dickinson added the comment: The behaviour is deliberate, if unfortunate: it's covered in the documentation here: https://docs.python.org/3/library/decimal.html#decimal-objects - see the paragraph starting > There are some small differences between arithmetic on Decimal objects > and

[issue42936] Decimal module performs wrong floor division with negative numbers

2021-01-15 Thread Jens
New submission from Jens : from decimal import Decimal print(-0.9//0.123) # prints -8.0 print(Decimal('-0.9')//Decimal('0.123')) # prints -7 print(-10//4.2) # prints -3.0 print(Decimal('-10')//Decimal('4.2')) # prints -2 -- messages: 385113 nosy: multiks2200 priority: normal severity:

[issue42930] xml.parsers.expat results differ buffer_text and / or buffer_size

2021-01-15 Thread Michael XU
Michael XU added the comment: Thank you so much Walter. I think that might be it - it fixed this particular instance, and it makes sense given what you have said. I'll proceed to close this up but will follow up if I encounter this issue when the data has changed. Thanks again! --

[issue42693] "if 0:" lines are traced; they didn't use to be

2021-01-15 Thread Mark Shannon
Change by Mark Shannon : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue42917] Block stack size for frame objects should be dynamically sizable

2021-01-15 Thread Mark Shannon
Mark Shannon added the comment: Reducing the size of the frame object seems like a worthwhile goal, but what's the point in increasing the maximum block stack? -- nosy: +Mark.Shannon ___ Python tracker

[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2021-01-15 Thread gaborjbernat
Change by gaborjbernat : -- nosy: +gaborjbernat ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42925] Error trace of else inside class

2021-01-15 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23047 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24222 ___ Python tracker ___

[issue42935] Pickle can't import builtins at exit

2021-01-15 Thread Pete Wicken
New submission from Pete Wicken : Originally found as an issue in Lib/shelve.py; if we attempt to pickle a builtin as the program is exiting then Modules/_pickle.c will fail at the point of the PyImport_Import in save_global. In CPython3.8 this causes a segfault, in CPython3.9 a

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Irit Katriel
Change by Irit Katriel : -- nosy: +ezio.melotti, michael.foord, rbcollins ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch pull_requests: +23046 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24221 ___ Python tracker ___

[issue7946] Convoy effect with I/O bound threads and New GIL

2021-01-15 Thread Maarten Breddels
Maarten Breddels added the comment: In case someone finds it useful, I've written a blog post on how to visualize the GIL: https://www.maartenbreddels.com/perf/jupyter/python/tracing/gil/2021/01/14/Tracing-the-Python-GIL.html In the comments (or at

[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-15 Thread Irit Katriel
Irit Katriel added the comment: Generally speaking, I don't think it's a good idea to create redundant APIs. If we copy all the params from TracebackException (and it will be all params, why only this one?) that means more code, more tests, more documentation and a higher cognitive load for

[issue42929] On Windows, shutil.move doesn't raise FileExistsError if dst exists like os.rename

2021-01-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Eryk Sun, do you mind to create a PR? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___

[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-15 Thread Ulrich Petri
Ulrich Petri added the comment: That would make it slightly better, but I still think it's a pretty arcane incantation (esp. for newer people). What makes you hesitant to adding the parameter to the convenience functions? -- ___ Python tracker

[issue42934] use TracebackException's new compact param in unittest.TestResult

2021-01-15 Thread Irit Katriel
New submission from Irit Katriel : The TracebackException instance created here https://github.com/python/cpython/blob/63298930fb531ba2bb4f23bc3b915dbf1e17e9e1/Lib/unittest/result.py#L185 is only used for format(), so it can benefit from the compact param added in issue42877. --

[issue42930] xml.parsers.expat results differ buffer_text and / or buffer_size

2021-01-15 Thread Walter Dörwald
Walter Dörwald added the comment: Just a guess, but the buffer size might be so small that the text that you expect gets passed via **two** calls to _char_data(). You should refactor your code the simply collect all the text in _char_data() and act on it in the _end_element() handler. So

[issue42927] Inline cache for slots

2021-01-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > What is the next step? I would say just finishing the PR (making sure that we do not miss some arcane edge case) and updating the what's new for 3.10 :) -- ___ Python tracker

[issue41837] Upgrade installers to OpenSSL 1.1.1i

2021-01-15 Thread Christian Heimes
Christian Heimes added the comment: I got bad news. OpenSSL 1.1.1i introduced a regression in cert validation. This affects some cases that involve self-signed certificates. Cert validation fails if a self-signed certificate is used as both a trust anchor (root CA) and EE cert. This may

[issue42933] OUTPUT WRONG

2021-01-15 Thread Christian Heimes
Christian Heimes added the comment: "No" is the correct output for your code example. Your code does not raise an exception, therefore the else block is executed. Please don't use the bug tracker to get assistance with learning Python. There are community resources like chat and forums

[issue42933] OUTPUT WRONG

2021-01-15 Thread Kkshitish
New submission from Kkshitish : try: a = 10 if a == 11: print ("Yes") except: print ("Out") else: print ("No") Output: No The output should be "Out" but it print "No", The else statement should be print when try condition is execute. But the try

[issue42931] Include randbytes in random.__all__

2021-01-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: