Type annotation pitfall

2021-09-23 Thread Robert Latest via Python-list
Hi all, this just caused me several hours of my life until I could whittle it down to this minimal example. Simple question: Why is the x member of object "foo" modified by initializing "bar"? Obviously, initializing foo with None doesn't set foo.x at all. So I guess x stays a class property,

Re: XML Considered Harmful

2021-09-23 Thread dn via Python-list
On 24/09/2021 14.07, Stefan Ram wrote: > dn writes: >> With that, why not code it as Python expressions, and include the module? > > This might create a code execution vulnerability if such > files are exchanged between multiple parties. The OP's spec, as quoted earlier(!), reads: "It's

Flush / update GUIs in PyQt5 during debugging in PyCharm

2021-09-23 Thread Mohsen Owzar
Hi Guys I've written a GUI using PyQt5 and in there I use StyleSheets (css) for the buttons and labels to change their background- and foreground-colors and their states as well. Because my program doesn't function correctly, I try to debug it in my IDE (PyCharm). The problem is that during

When should I use "parent=None" in __ini__ and "parent" in super()

2021-09-23 Thread Mohsen Owzar
Hi Guys I'm writing since almost one-year codes in Python, using TKinter and PyQt5. I'm somehow able to writes GUIs in both of them. But since I'm using more Pyqt5 and using classes with initialization and super() constructs, and also I saw lots of videos and examples of coding them, I still

[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-09-23 Thread Chuanlong Du
New submission from Chuanlong Du : I have command-line script `blog` written using argparse. It supports subcommands. When I check the help doc of a subcommand, e.g., using `blog convert -h`, it prints the help doc of the subcommand `blog convert` but doesn't print the description of the

Re: XML Considered Harmful

2021-09-23 Thread Chris Angelico
On Fri, Sep 24, 2021 at 1:44 PM Dan Stromberg wrote: > > > On Thu, Sep 23, 2021 at 8:12 PM Chris Angelico wrote: >> >> One good hybrid is to take a subset of Python syntax (so it still >> looks like a Python script for syntax highlighting etc), and then >> parse that yourself, using the ast

Re: XML Considered Harmful

2021-09-23 Thread Dan Stromberg
On Thu, Sep 23, 2021 at 8:12 PM Chris Angelico wrote: > One good hybrid is to take a subset of Python syntax (so it still > looks like a Python script for syntax highlighting etc), and then > parse that yourself, using the ast module. For instance, you can strip > out comments, then look for

Re: XML Considered Harmful

2021-09-23 Thread Chris Angelico
On Fri, Sep 24, 2021 at 12:22 PM Stefan Ram wrote: > > dn writes: > >With that, why not code it as Python expressions, and include the module? > > This might create a code execution vulnerability if such > files are exchanged between multiple parties. > > If code execution vulnerabilities

Re: XML Considered Harmful

2021-09-23 Thread dn via Python-list
On 22/09/2021 07.22, Michael F. Stemper wrote: > On 21/09/2021 13.49, alister wrote: >> On Tue, 21 Sep 2021 13:12:10 -0500, Michael F. Stemper wrote: >> >>> On the prolog thread, somebody posted a link to: >>> Given the source, shouldn't

[issue45020] Freeze all modules imported during startup.

2021-09-23 Thread Eric Snow
Change by Eric Snow : -- pull_requests: +26923 pull_request: https://github.com/python/cpython/pull/28538 ___ Python tracker ___

Re: XML Considered Harmful

2021-09-23 Thread Jon Ribbens via Python-list
On 2021-09-23, Stefan Ram wrote: > The real problem with CSV is that there is no CSV. > > This is not a specific data language with a specific > specification. Instead it is a vague designation for > a plethora of CSV dialects, which usually dot not even > have a specification. Indeed.

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread Eryk Sun
Eryk Sun added the comment: See bpo-21822 from 2014, which I think was the first report of this issue. -- nosy: +eryksun ___ Python tracker ___

[issue39359] zipfile: add missing "pwd: expected bytes, got str" exception message

2021-09-23 Thread Daniel Hillier
Daniel Hillier added the comment: Thanks Łukasz! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset d672dd34f0bc3addeaf1789d4183e3a37ab110d5 by Miss Islington (bot) in branch '3.9': bpo-38623: Add note about site module (site-packages) (GH-16974) (GH-28537) https://github.com/python/cpython/commit/d672dd34f0bc3addeaf1789d4183e3a37ab110d5

[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: Thanks, Peter! ✨  ✨ -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10, Python 3.11 -Python 3.7, Python 3.8 ___ Python tracker

[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 87f97fe5e6434da51246d70af9e2cd7d63c29fba by Miss Islington (bot) in branch '3.10': bpo-38623: Add note about site module (site-packages) (GH-16974) (GH-28536) https://github.com/python/cpython/commit/87f97fe5e6434da51246d70af9e2cd7d63c29fba

[issue45274] Race condition in Thread._wait_for_tstate_lock()

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

Re: XML Considered Harmful

2021-09-23 Thread Chris Angelico
On Fri, Sep 24, 2021 at 7:11 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, Christian Gollwitzer wrote: > > Am 22.09.21 um 16:52 schrieb Michael F. Stemper: > >> On 21/09/2021 19.30, Eli the Bearded wrote: > >>> Yes, CSV files can model that. But it would not be my

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Add a context manager which suppresses keyboard interruption. That's not enough technically. This can be any signal handler that raises an exception, no? -- ___ Python tracker

RE: XML Considered Harmful

2021-09-23 Thread Avi Gross via Python-list
What you are describing Stephen, is what I meant by emulating a relational database with tables. And, FYI, There is no guarantee that two authors with the same name will not be assumed to be the same person. Besides the lack of any one official CSV format, there are oodles of features I have

[issue45026] More compact range iterator

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: Good point benchmarking small iterations too, Dennis. I missed that. Agreed then, GH-27986 looks like a winner. -- ___ Python tracker ___

[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread miss-islington
Change by miss-islington : -- pull_requests: +26921 pull_request: https://github.com/python/cpython/pull/28536 ___ Python tracker ___

[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 55b45bf707c6c8084db259fe2f8aa08e84ea0d99 by Peter Bittner in branch 'main': bpo-38623: Add note about site module (site-packages) (GH-16974) https://github.com/python/cpython/commit/55b45bf707c6c8084db259fe2f8aa08e84ea0d99 -- nosy:

[issue38623] Python documentation should mention how to find site-packages

2021-09-23 Thread miss-islington
Change by miss-islington : -- pull_requests: +26922 pull_request: https://github.com/python/cpython/pull/28537 ___ Python tracker ___

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am not sure that it can be solved at Python level. Possible solutions: * Add a Lock method (or just a builtin function) which acquires and immediately releases the lock, without possibility to interrupt. if lock._blink(block, timeout):

[issue39359] zipfile: add missing "pwd: expected bytes, got str" exception message

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: Thanks, Daniel! ✨  ✨ -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.11 -Python 3.7, Python 3.8, Python 3.9 ___ Python tracker

[issue39359] zipfile: add missing "pwd: expected bytes, got str" exception message

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 91099e25446b214725f8e2bec6f90553260c by Daniel Hillier in branch 'main': bpo-39359: [zipfile] add missing "pwd: expected bytes, got str" exception (GH-18031) https://github.com/python/cpython/commit/91099e25446b214725f8e2bec6f90553260c

[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: Look, not even 23 months to land this thing! Thanks, Jason! ✨  ✨ -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.11 -Python 3.7, Python 3.8, Python 3.9 ___ Python

[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 86b833badd3d6864868404ead2f8c7994d24f85c by Jason Fried in branch 'main': bpo-38415: Allow using @asynccontextmanager-made ctx managers as decorators (GH-16667) https://github.com/python/cpython/commit/86b833badd3d6864868404ead2f8c7994d24f85c

RE: XML Considered Harmful

2021-09-23 Thread Avi Gross via Python-list
Can we agree that there are way more general ways to store data than anything currently in common use and that in some ways, CSV and cousins like TSV are a subset of the others in a sense? There are trees and arbitrary graphs and many complex data structures often encountered while a program is

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Josh Haberman
Josh Haberman added the comment: > It's better to pass the metaclass as a function argument, as with bases. I'd > prefer adding a new function that using a slot. Bases are available both as a slot (Py_tp_bases) and as an argument (PyType_FromSpecWithBases). I don't see why this has to be

Re: XML Considered Harmful

2021-09-23 Thread Michael F. Stemper
On 23/09/2021 12.51, Eli the Bearded wrote: Am 22.09.21 um 16:52 schrieb Michael F. Stemper: On 21/09/2021 19.30, Eli the Bearded wrote: Yes, CSV files can model that. But it would not be my first choice of data format. (Neither would JSON.) I'd probably use XML. Okay. 'Go not to the elves

Re: XML Considered Harmful

2021-09-23 Thread Michael F. Stemper
On 22/09/2021 17.37, Dennis Lee Bieber wrote: On Wed, 22 Sep 2021 09:52:59 -0500, "Michael F. Stemper" declaimed the following: On 21/09/2021 19.30, Eli the Bearded wrote: In comp.lang.python, Michael F. Stemper wrote: How does CSV handle hierarchical data? For instance, I have Can CSV

Re: XML Considered Harmful

2021-09-23 Thread Christian Gollwitzer
Am 22.09.21 um 16:52 schrieb Michael F. Stemper: On 21/09/2021 19.30, Eli the Bearded wrote: Yes, CSV files can model that. But it would not be my first choice of data format. (Neither would JSON.) I'd probably use XML. Okay. 'Go not to the elves for counsel, for they will say both no and

Re: XML Considered Harmful

2021-09-23 Thread Eli the Bearded
In comp.lang.python, Christian Gollwitzer wrote: > Am 22.09.21 um 16:52 schrieb Michael F. Stemper: >> On 21/09/2021 19.30, Eli the Bearded wrote: >>> Yes, CSV files can model that. But it would not be my first choice of >>> data format. (Neither would JSON.) I'd probably use XML. >> Okay. 'Go

Re: Free OCR package in Python and selecting appropriate widget for the GUI

2021-09-23 Thread Mohsen Owzar
DFS schrieb am Mittwoch, 22. September 2021 um 09:41:42 UTC+2: > On 9/22/2021 1:54 AM, Mohsen Owzar wrote: > > DFS schrieb am Mittwoch, 22. September 2021 um 05:10:30 UTC+2: > >> On 9/21/2021 10:38 PM, Mohsen Owzar wrote: > >>> DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2: >

téléchargement python

2021-09-23 Thread olivier Perchet
Envoye `a partir de [1]Courrier pour Windows [2][IMG] Garanti sans virus. [3]www.avast.com References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 2. https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=emailclient

[issue45101] Small inconsistency in usage message between the python and shell script versions of python-config

2021-09-23 Thread Kien Dang
Kien Dang added the comment: Thanks. I didn't know about the `pkg-config` thing. I just checked with pkg-config on macOS `pkg-config --help` prints usage instructions to stdout pkg-config followed by invalid options prints output to stderr, for example `pkg-config --asdf` prints `Unknown

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 55576893b31452ba739e01189424cd62cf11ed20 by Miss Islington (bot) in branch '3.10': bpo-43760: Document PyThreadState.use_tracing removal (GH-28527) (GH-28529) https://github.com/python/cpython/commit/55576893b31452ba739e01189424cd62cf11ed20

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +pablogsal stage: patch review -> ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26920 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28532 ___ Python tracker ___

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: For curious people, see also bpo-44422 "Fix threading.enumerate() reentrant call": another example of race condition recently fixed in the threading module. But it's unrelated to this bug ;-) -- ___ Python

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : Added file: https://bugs.python.org/file50300/threading_bug.py ___ Python tracker ___ ___ Python-bugs-list

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread STINNER Victor
New submission from STINNER Victor : Bernát Gábor found an interesting bug on Windows. Sometimes, when a process is interrupted on Windows with CTRL+C, its parent process hangs in thread.join(): https://twitter.com/gjbernat/status/1440949682759426050 Reproducer: * Install

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Steve Dower
Steve Dower added the comment: But at least if it's available as a slot then a module is *able* to use it with limited ABI going backwards. A new function doesn't allow that. And yeah, it means they have to write more complex code than just a static array definition, but people are willing

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Petr Viktorin
Petr Viktorin added the comment: - specs/slots are (usually) constant & static; pointers to types are not always C constant expressions (on Windows, if they come from a different DLL) - specs/slots are (usually) shared across all subinterpreters; types are specific to a single interpreter

[issue44309] Add support for yescrypt in crypt.

2021-09-23 Thread David Mandelberg
Change by David Mandelberg : -- nosy: +dseomn ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Josh Haberman
Josh Haberman added the comment: > Passing the metaclass as a slot seems like the right idea for this API, > though I recall there being some concern about the API (IIRC, mixing function > pointers and data pointers doesn't work on some platforms?) PyType_Slot is defined as a void* (not a

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-23 Thread Jeremy Maitin-Shepard
Jeremy Maitin-Shepard added the comment: In general, I view hanging threads as the least bad thing to do when faced with either acquiring the GIL or not returning at all. There is a lot of existing usage of Python that currently poses a risk of random crashes and memory corruption while

[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Though I wouldn't like to lose the ability to extract the Python stack by > inspecting native memory alone. Don't worry about it, I am personally making sure that keeps being possible. it will need some changes in the tools, but not any more that

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Sebastian Berg
Sebastian Berg added the comment: I can make a PR from the patch (and add the `Py_tp_metaclass` slot if desired) with a basic test here, if that is what is blocking things. Fixing the type and size of the allocation (as the patch does) would allow me to give people a way to create a new

[issue45272] 'os.path' should not be a frozen module

2021-09-23 Thread Eric Snow
Eric Snow added the comment: The matter here boils down to the design of _imp.is_frozen() [1]. It only checks to see if the given module name shows up in the list of frozen modules in Python/frozen.c. This broke things when I froze os and posixpath/ntpath. The simplest solution was to

[issue45273] OS-specific frozen modules are built, even on other OSes.

2021-09-23 Thread Eric Snow
Eric Snow added the comment: FYI, currently os.path is also frozen and *is* OS-specific. However, that's a separate matter. See bpo-45272. -- ___ Python tracker ___

[issue45273] OS-specific frozen modules are built, even on other OSes.

2021-09-23 Thread Eric Snow
New submission from Eric Snow : The list of frozen modules in Python/frozen.c is generated by Tools/scripts/freeze_modules.py. Currently we freeze both posixpath and ntpath, even though for startup we only need one of the two (depending on the OS). In this case both modules are available

[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is one bit of symmetry that we shouldn't pursue. The find() methods have been a recurring source of bugs because of failing to check for a -1 result but having that be a valid index into the sequence. Also, the sequence APIs are long established.

[issue44687] io.BufferedReader:peek() closes underlying file, breaking peek/read expectations

2021-09-23 Thread Steve Dower
Steve Dower added the comment: Seems like it would be better to not check the file open/closed state on peek/read when there is still buffered data? -- nosy: +steve.dower ___ Python tracker

[issue15870] PyType_FromSpec should take metaclass as an argument

2021-09-23 Thread Steve Dower
Steve Dower added the comment: Passing the metaclass as a slot seems like the right idea for this API, though I recall there being some concern about the API (IIRC, mixing function pointers and data pointers doesn't work on some platforms?) that mean it'll be deprecated in the future.

[issue40346] Add random.BaseRandom to ease implementation of subclasses

2021-09-23 Thread Matt Bogosian
Matt Bogosian added the comment: Thanks! Where's that documented? (Apologies if I missed it.) -- ___ Python tracker ___ ___

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-23 Thread Gregory P. Smith
Gregory P. Smith added the comment: A PR adding a `Py_SetThreadExitCallback(func)` API guaranteeing the callback is called before `pthread_exit()` would allow anyone wanting to deal with their deadlocks to register `abort()` or `while(1) pause();` as their exit callback. I'd be okay with

[issue40346] Add random.BaseRandom to ease implementation of subclasses

2021-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Matt, your example works in 3.11. In earlier versions you need to override the __new__ method. -- ___ Python tracker ___

[issue45244] pip not installed with fresh python3.8.10 installation

2021-09-23 Thread Steve Dower
Steve Dower added the comment: Can you attach the log files stored in your %TEMP% as a zip file? They should all start with "Python". Be aware that they may contain personal information, such as usernames or machine names. Feel free to scrub those first if necessary. -- nosy:

[issue45272] 'os.path' should not be a frozen module

2021-09-23 Thread Steve Dower
New submission from Steve Dower : I noticed that Python/frozen.c includes posixpath as 'os.path'. This is not correct, and shouldn't be necessary anyway, because os.path is just an attribute in "os" and not a concrete module (see Lib/os.py#L95 for the bit that makes it importable, and

[issue45213] Frozen modules are looked up using a linear search.

2021-09-23 Thread Steve Dower
Steve Dower added the comment: Could we add a compile-time requirement (most likely checked in tests, rather than at build) that _PyImport_FrozenModules be sorted? Then we can at least bail out of the loop early, and one day someone could make it a binary search. -- nosy:

[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Steve Dower
Steve Dower added the comment: I fully support implementing the core idea of Stackless Python :) I spent a whole EuroPython a couple of years back discussing the idea with (apparently) everyone except Mark. Though I wouldn't like to lose the ability to extract the Python stack by

[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Terry J. Reedy
Terry J. Reedy added the comment: You added the same file twice. Once was enough. To repeat: IDLE has no knowledge of color chooser. The Custom Colors bar is Windows specific. There is no such thing on macOS. PS: when responding by email, please delete the quoted message. It is

[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Steve Dower
Steve Dower added the comment: Strings are already special in that str.index() and str.find() both find substrings, while list.index() only finds a single element. If .find() also searched for a substring of the list, I think this could be helpful. Even more so if it used an efficient

[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod
Pramod added the comment: I understand that, but is it possible to keep only unique colors in the Custom Color palette, and when user chooses the exact same color to be in the Custom Color palette it would return a pop up like "Color already in Custom Color palette". It would be better if the

[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod
Pramod added the comment: Sorry for adding my file again. Can you please state the reason for removing the file Mr. Terry J Reedy , was it because I haven't signed the Contributor Agreement at that time? But now that I have signed it, can I add thehttps://bugs.python.org/file50298/python

[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Terry J. Reedy
Terry J. Reedy added the comment: IDLE has nothing to do with the operation of the color chooser. IDLE calls a tkinter function that calls a tk functions that calls the OS Window Manager color chooser. The choice you make is returned to IDLE as a color string that IDLE can later pass to

[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Terry J. Reedy
Change by Terry J. Reedy : Removed file: https://bugs.python.org/file50297/python bug 1.png ___ Python tracker ___ ___ Python-bugs-list

[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod
Change by Pramod : Added file: https://bugs.python.org/file50298/python bug 1.png ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue45270] Clicking "Add to Custom Colors" adds same colour multiple times

2021-09-23 Thread Pramod
New submission from Pramod : When customising my Python IDLE (in Options>Configure IDLE>Highlights>Choose color for:), if I choose a color from the palette and click on the button "Add to Custom Colors" multiple times, all my existing colors are replaced by a single color one by one, instead

[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Dávid Nemeskey
Change by Dávid Nemeskey : -- type: -> enhancement ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45271] Add a 'find' method (a'la str) to list

2021-09-23 Thread Dávid Nemeskey
New submission from Dávid Nemeskey : There is an unjustified asymmetry between `str` and `list`, as far as lookup goes. Both have an `index()` method that returns the first index of a value, or raises a `ValueError` if it doesn't exist. However, only `str` has the `find` method, which returns

[issue45270] Clicking "Add to Custom C

2021-09-23 Thread Pramod
Change by Pramod : -- nosy: pramodsarathy17 priority: normal severity: normal status: open title: Clicking "Add to Custom C ___ Python tracker ___

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 11.0 -> 12.0 pull_requests: +26919 pull_request: https://github.com/python/cpython/pull/28529 ___ Python tracker

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: New changeset f4ccb79d52ee726d58bbb038ea98b4deec52001d by Victor Stinner in branch 'main': bpo-43760: Document PyThreadState.use_tracing removal (GH-28527) https://github.com/python/cpython/commit/f4ccb79d52ee726d58bbb038ea98b4deec52001d --

[issue40346] Add random.BaseRandom to ease implementation of subclasses

2021-09-23 Thread Matt Bogosian
Matt Bogosian added the comment: I landed here after investigating this surprising result: # test_case.py from random import Random from typing import Sequence, Union _RandSeed = Union[None, int, Sequence[int]] class MyRandom(Random): def __init__( self, seed:

Re: XML Considered Harmful

2021-09-23 Thread Chris Angelico
On Thu, Sep 23, 2021 at 10:55 PM Mats Wichmann wrote: > > On 9/22/21 10:31, Dennis Lee Bieber wrote: > > > If you control both the data generation and the data consumption, > > finding some format ... > > This is really the key. I rant at people seeming to believe that csv is > THE data

Re: XML Considered Harmful

2021-09-23 Thread Mats Wichmann
On 9/22/21 10:31, Dennis Lee Bieber wrote: If you control both the data generation and the data consumption, finding some format ... This is really the key. I rant at people seeming to believe that csv is THE data interchange format, and it's about as bad as it gets at that, if

[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2021-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are several common idioms which do not work well with shared dictionaries. 1. Class attributes as defaults. If most instances of the class have the default value for some attribute, it can be set as the class attribute. It saves memory because most

[issue41629] __class__ not set defining 'X' as

2021-09-23 Thread Marc Mueller
Change by Marc Mueller : -- nosy: +cdce8p ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2021-09-23 Thread Mark Shannon
Mark Shannon added the comment: Raymond, Only split dicts need the extra field. Classes where many instances do not have exactly the same set of attributes may be more common than you think. There are many reasons why some attributes may be added conditionally. PR 28520 actually makes the

[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Mark Shannon
Mark Shannon added the comment: I've trying to do this since about 2011 :) -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue41203] Replace references to OS X in documentation with macOS

2021-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Patrick. We had several PRs for fixing macOS references here and there, they were closed in favor of this larger PR. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___

[issue44958] [sqlite3] only reset statements when needed

2021-09-23 Thread Erlend E. Aasland
Erlend E. Aasland added the comment: Explicitly resetting statements when we're done with them removes the performance regression; SQLite works more efficient when we keep the number of non-reset statements low. -- ___ Python tracker

[issue41203] Replace references to OS X in documentation with macOS

2021-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f1d5cdef57fea961646c52db7a60d1f110e0eaa6 by Miss Islington (bot) in branch '3.9': bpo-41203: Replace Mac OS X and OS X with macOS (GH-28515) (GH-28524) https://github.com/python/cpython/commit/f1d5cdef57fea961646c52db7a60d1f110e0eaa6

[issue41203] Replace references to OS X in documentation with macOS

2021-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 1493e1a40d04a048cce9c5080ec47478a4941054 by Miss Islington (bot) in branch '3.10': bpo-41203: Replace Mac OS X and OS X with macOS (GH-28515) (GH-28523) https://github.com/python/cpython/commit/1493e1a40d04a048cce9c5080ec47478a4941054

[issue42969] pthread_exit & PyThread_exit_thread from PyEval_RestoreThread etc. are harmful

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: I'm not comfortable with PR 28525 which always hang threads which attempt to acquire the GIL after Python exited. I would prefer to keep the current behavior by default, but give the ability to applications embedding Python to decide what to do. With my

[issue29921] datetime validation is stricter in 3.6.1 than previous versions

2021-09-23 Thread Patrick Decat
Patrick Decat added the comment: pywin32 project has moved from sourceforge to github. https://sourceforge.net/p/pywin32/bugs/748/ is now at https://github.com/mhammond/pywin32/issues/748 pywin32 issue is supposed to be resolved since pywin32 b222 See:

[issue45256] Remove the usage of the C stack in Python to Python calls

2021-09-23 Thread Christian Tismer
Christian Tismer added the comment: Hey guys, you know that you are about to implement the core idea of Stackless Python, right? :-D -- nosy: +Christian.Tismer ___ Python tracker

[issue41137] pdb uses the locale encoding for .pdbrc

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: New changeset ec7ffa4b5b262369f726a54e145e9c03eaeb4c1a by Victor Stinner in branch 'main': bpo-41137: Reorganize What's New in Python 3.11 (GH-28518) https://github.com/python/cpython/commit/ec7ffa4b5b262369f726a54e145e9c03eaeb4c1a --

[issue45267] New install Python 3.9.7 install of Sphinx Document Generator fails

2021-09-23 Thread Ronald Oussoren
Ronald Oussoren added the comment: The error in the attached file says that one of the dependencies could not be found, in particular the "packaging" library. This doesn't look like a bug in CPython or pip, but more a general support question. I kindly ask you to visit one of the python

[issue45269] c_make_encoder() has uncovered error: "argument 1 must be dict or None"

2021-09-23 Thread Nikita Sobolev
New submission from Nikita Sobolev : Looks like we never test error that `markers` are limited to `None` and `dict` types. Here: https://github.com/python/cpython/blob/main/Modules/_json.c#L1252-L1255 Coverage report: https://app.codecov.io/gh/python/cpython/blob/master/Modules/_json.c

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor
STINNER Victor added the comment: I created PR 28527 to document PyThreadState.use_tracing removal and explain how to port existing code to Python 3.10. -- ___ Python tracker

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-09-23 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +26918 pull_request: https://github.com/python/cpython/pull/28527 ___ Python tracker ___

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-23 Thread neonene
neonene added the comment: 3.10rc2 Python/ceval.c 1306: #define DISPATCH() \ 1307: { \ 1308: if (trace_info.cframe.use_tracing OR_DTRACE_LINE OR_LLTRACE) { \ 1309: goto tracing_dispatch; \ Among the 44 pgo-tests, only test_patma.TestTracing hits the condition above.

[issue45268] use multiple "in" in one expression?

2021-09-23 Thread Dennis Sweeney
Dennis Sweeney added the comment: This is the expected behavior, documented here: https://docs.python.org/3/reference/expressions.html#comparisons That page says: * The comparison operators are "<" | ">" | "==" | ">=" | "<=" | "!=" | "is" ["not"] | ["not"] "in" * "Comparisons can