[issue42945] weakref.finalize documentation contradicts itself RE: finalizer callback or args referencing object

2021-01-16 Thread Ryan Heisler
Ryan Heisler added the comment: Perfect, thanks for your quick response. I was passing a bound method of obj as the func to `weakref.finalize(obj, func, /, *args, **kwargs)`. It slipped my mind that an instance variable like self.name and a bound method like self.clean_up, though they both

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread Terry Reedy
On 1/16/2021 9:17 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: A bare minimum skeleton might look something like this: with open(filename) as f: for line in f.readlines(): handle_one_line(f) f.readlines() reads the entire file into a list of lines (strings). If

Re: Python not Running

2021-01-16 Thread Terry Reedy
On 1/16/2021 3:55 PM, Logan Cranford wrote: I downloaded Python but when I try to run Idle it says it is not found and From where? try how? what is 'it'? Read the section of https://docs.python.org/3/using/index.html appropriate for your system, likely Windows. I should try to redownload it.

Using plotly and getting "This site can't be reached"

2021-01-16 Thread Chuck Untulis
The Chrome browser on the machine shows "127.0.0.1 refused to connect" for various urls of the form 127.0.0.1:x where x are numbers like 64981, 65029,... About once in 20-40 attempts, the graphs appear. I ran the same code on a different machine and it created the plots in the Chrome

[issue42945] weakref.finalize documentation contradicts itself RE: finalizer callback or args referencing object

2021-01-16 Thread Tim Peters
Tim Peters added the comment: Not a problem. Arguments to a function are evaluated before the function is invoked. So in self._finalizer = weakref.finalize(self, shutil.rmtree, self.name) self.name is evaluated before weakref.finalize is called(). `self.name` _extracts_ the `.name`

[issue42945] weakref.finalize documentation contradicts itself RE: finalizer callback or args referencing object

2021-01-16 Thread Ryan Heisler
New submission from Ryan Heisler : In the documentation for `weakref.finalize` (https://docs.python.org/3.9/library/weakref.html#weakref.finalize), it says: "Note It is important to ensure that func, args and kwargs do not own any references to obj, either directly or indirectly, since

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: I've encountered this issue again with a different use-case. I'm attempting to add a doctest to a routine that emits the paths of the files it processes. I want to use ellipses to ignore the prefixes of the output because they're not pertinent to the test.

[issue42944] random.Random.sample bug when counts is not None

2021-01-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: Would you like to submit a PR for this? -- ___ Python tracker ___ ___ Python-bugs-list

[issue42944] random.Random.sample bug when counts is not None

2021-01-16 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread 2QdxY4RzWzUUiLuE
On 2021-01-16 at 17:46:13 -0500, DonK wrote: > On Sat, 16 Jan 2021 14:56:37 -0600, 2qdxy4rzwzuui...@potatochowder.com > wrote: > > >On 2021-01-16 at 15:42:44 -0500, > >DonK wrote: > >> For example, I've found a need to parse text documents quite a number > >> of times over the years. Basic/VB

Re: Exploring terminfo

2021-01-16 Thread Eryk Sun
On 1/16/21, Greg Ewing wrote: > On 17/01/21 12:40 pm, Chris Angelico wrote: >> This is true. However, at some point, the boundary is crossed from >> Python into the C library. Something, at that point, knows. It's very >> common to have a flush option available, so it should be used. > > I'm

Re: count consecutive elements

2021-01-16 Thread Dan Stromberg
On Thu, Jan 14, 2021 at 2:01 PM Wolfram Hinderer via Python-list < python-list@python.org> wrote: > Am 13.01.2021 um 22:20 schrieb Bischoop: > > I want to to display a number or an alphabet which appears mostly > > consecutive in a given string or numbers or both > > Examples > > s= '

ANN: Blue 0.5.1 Released

2021-01-16 Thread Grant Jenks
Announcing the release of Blue version 0.5.1 Blue Some folks like `black `_ but I prefer `blue `_. What is blue? = ``blue`` is a somewhat less uncompromising code formatter than ``black``,

Re: Exploring terminfo

2021-01-16 Thread Chris Angelico
On Sun, Jan 17, 2021 at 11:06 AM Greg Ewing wrote: > > On 17/01/21 12:40 pm, Chris Angelico wrote: > > This is true. However, at some point, the boundary is crossed from > > Python into the C library. Something, at that point, knows. It's very > > common to have a flush option available, so it

Re: Exploring terminfo

2021-01-16 Thread Greg Ewing
On 17/01/21 12:40 pm, Chris Angelico wrote: This is true. However, at some point, the boundary is crossed from Python into the C library. Something, at that point, knows. It's very common to have a flush option available, so it should be used. I'm wondering whether the problem in this

Re: Exploring terminfo

2021-01-16 Thread Chris Angelico
On Sun, Jan 17, 2021 at 10:36 AM Greg Ewing wrote: > > On 16/01/21 4:17 pm, Chris Angelico wrote: > > But somewhere along the way, you're finding that there's a problem, > > which implies that SOMETHING is calling on C stdio. That thing, > > surely, should be the thing responsible for flushing? >

Python not Running

2021-01-16 Thread Logan Cranford
I downloaded Python but when I try to run Idle it says it is not found and I should try to redownload it. When I try to do that all that comes up is a page that says modify, repair or uninstall. I have repaired several times but it still gives me the same message. Can anyone help me with this? --

Re: Exploring terminfo

2021-01-16 Thread Greg Ewing
On 16/01/21 4:17 pm, Chris Angelico wrote: But somewhere along the way, you're finding that there's a problem, which implies that SOMETHING is calling on C stdio. That thing, surely, should be the thing responsible for flushing? The C library using stdio has no way of knowing that something

[issue42944] random.Random.sample bug when counts is not None

2021-01-16 Thread Jon FRANCO
New submission from Jon FRANCO : Hello, If I am reading right, random.Random.sample method has a bug if counts is not None. Line 482 (of master): """ selections = sample(range(total), k=k) """ this is calling the module function 'sample' and not the instance method. IMO this

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Sat, 16 Jan 2021 14:56:37 -0600, 2qdxy4rzwzuui...@potatochowder.com wrote: >On 2021-01-16 at 15:42:44 -0500, >DonK wrote: > >> Yes, Windows. Iterating open windows with the Window's API is easy the >> hard (very hard) part is sending keystrokes to those windows to Save >> them. It's very

[issue42943] singledispatchmethod should expose registry of all known overloads

2021-01-16 Thread Ilya Kulakov
New submission from Ilya Kulakov : The wrapper created by singledispatchmethod does not (trivially) expose registry of all known overloads. Consider the following example: @singledispatchmethod def on_message(message): raise NotImplementedError @on_message.register

[issue42942] Feature request: Add decdigest() to hashlib

2021-01-16 Thread Arnim Rupp
New submission from Arnim Rupp : Problem: hashlib only offers digest() and hexdigest() but the fastest way to work with hashes is as integer. The first thing loki does after getting the hashes is to convert them to int: md5, sha1, sha256 = generateHashes(fileData)

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Arnim Rupp
Change by Arnim Rupp : -- components: +Regular Expressions -Library (Lib) nosy: +ezio.melotti, mrabarnett ___ Python tracker ___

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Tue, 12 Jan 2021 10:16:47 +0400, Abdur-Rahmaan Janhangeer wrote: >Greetings, > >Web with Python is really easy to get started with, here >is a simple endpoint with a framework called Flask > >from flask import Flask >app = Flask(__name__) > >@app.route('/') >def hello_world(): > return

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread 2QdxY4RzWzUUiLuE
On 2021-01-16 at 15:42:44 -0500, DonK wrote: > Yes, Windows. Iterating open windows with the Window's API is easy the > hard (very hard) part is sending keystrokes to those windows to Save > them. It's very tricky because the timing is critical. > > You have to use one of those "spy" utilities

[issue42935] Pickle can't import builtins at exit

2021-01-16 Thread Christian Heimes
Christian Heimes added the comment: At the end of a Python process, the interpreter is shut down in multiple steps. Object finalizers such as __del__ may be executed late in the interpreter shut down process. In your case, most of the interpreter is already gone. There isn't anything we can

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Mon, 11 Jan 2021 21:56:48 -0800, Paul Rubin wrote: >DonK writes: >> My problem is that I don't understand how Python programs are >> used. (i.e user input and output) Is Python mainly used for backends? >> I've seen some Python gui frameworks like Tkinter, PyQt, etc > >I would say at

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread DonK
On Tue, 12 Jan 2021 09:26:18 +1100, Chris Angelico wrote: >On Tue, Jan 12, 2021 at 7:41 AM DonK wrote: >> Hi, I'm thinking about learning Python but I'm 74 years old and will >> very likely not ever have a programming job again. I used to program >> in Visual Basic, C\C++, Delphi, etc. and some

[issue42659] Objects of uname_result Class Cannot be Successfully Pickled

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10 ___ Python tracker ___

[issue42189] copy.deepcopy() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42163] _replace() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42189] copy.deepcopy() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: New changeset 799722cb0ddb90752cde7798cab543f30623ebf2 by Jason R. Coombs in branch '3.9': [3.9] bpo-42163, bpo-42189, bpo-42659: Support uname_tuple._replace (for all but processor) (GH-23010) (#24232)

[issue42163] _replace() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: New changeset 799722cb0ddb90752cde7798cab543f30623ebf2 by Jason R. Coombs in branch '3.9': [3.9] bpo-42163, bpo-42189, bpo-42659: Support uname_tuple._replace (for all but processor) (GH-23010) (#24232)

[issue42659] Objects of uname_result Class Cannot be Successfully Pickled

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: New changeset 799722cb0ddb90752cde7798cab543f30623ebf2 by Jason R. Coombs in branch '3.9': [3.9] bpo-42163, bpo-42189, bpo-42659: Support uname_tuple._replace (for all but processor) (GH-23010) (#24232)

[issue42189] copy.deepcopy() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- pull_requests: +23056 pull_request: https://github.com/python/cpython/pull/24232 ___ Python tracker ___

[issue42659] Objects of uname_result Class Cannot be Successfully Pickled

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- pull_requests: +23057 pull_request: https://github.com/python/cpython/pull/24232 ___ Python tracker ___

[issue42163] _replace() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- pull_requests: +23055 pull_request: https://github.com/python/cpython/pull/24232 ___ Python tracker ___

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

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

Re: Issues with running python in Command prompt

2021-01-16 Thread Mats Wichmann
On 1/16/21 8:30 AM, mohsen shooshtari wrote: hello, Thanks in advance for your consideration. I install python3.8 and then install Pycharm but when I call python in Command prompt, followed by ( 'python' is not recognized as an internal or external command, operable program or batch file. what

Re: Issues with running python in Command prompt

2021-01-16 Thread OmPs
On Sat, 16 Jan 2021, 23:51 mohsen shooshtari, wrote: > hello, > Thanks in advance for your consideration. I install python3.8 and then > install Pycharm but when I call python in Command prompt, followed by > ( 'python' > is not recognized as an internal or external command, operable program or

Re: Exploring terminfo

2021-01-16 Thread Alan Gauld via Python-list
On 15/01/2021 21:41, Dennis Lee Bieber wrote: > On Fri, 15 Jan 2021 13:19:26 +, Alan Gauld via Python-list > declaimed the following: > >> So the native C functions work as expected. >> Why does the Python wrapper not? > > Are you running Python from a plain command shell, or from

Re: HEKLP

2021-01-16 Thread Grant Edwards
Perhaps once you get your 'K' key fixed it'll work better. -- https://mail.python.org/mailman/listinfo/python-list

Issues with running python in Command prompt

2021-01-16 Thread mohsen shooshtari
hello, Thanks in advance for your consideration. I install python3.8 and then install Pycharm but when I call python in Command prompt, followed by ( 'python' is not recognized as an internal or external command, operable program or batch file. what should I do to fix this problem? --

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- versions: -Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42941] Infinite loop in asyncio sslproto

2021-01-16 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch nosy: +python-dev nosy_count: 3.0 -> 4.0 pull_requests: +23053 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24230 ___ Python tracker

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread miss-islington
Change by miss-islington : -- pull_requests: +23052 pull_request: https://github.com/python/cpython/pull/24229 ___ Python tracker ___

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread miss-islington
miss-islington added the comment: New changeset f08c66467d56c71f75c6659ede9177449fe9d2e6 by William Schwartz in branch '3.8': [3.8] bpo-42531: Teach importlib.resources.path to handle packages without __file__ (GH-23611)

[issue42941] Infinite loop in asyncio sslproto

2021-01-16 Thread Hingyuen Lam
New submission from Hingyuen Lam : There is an infinite loop in feed_appdata() of sslproto.py. The OpenSSL documents said when some fatal I/O error occurred, SSL_ERROR_SYSCALL is returned and no further I/O operations should be performed. This error is ignored in the exception handling of

[issue42940] Incorrect behavior of inspect.signature(f).bind

2021-01-16 Thread Slava Kostrov
New submission from Slava Kostrov : >>> def foo(a, /, b=1, **kwargs): pass ... >>> foo(a=1) Traceback (most recent call last): File "", line 1, in TypeError: foo() missing 1 required positional argument: 'a' >>> inspect.signature(foo).bind(a=1) Traceback (most recent call last): File "",

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Arnim Rupp
Arnim Rupp added the comment: some more observations, which might be helpful in tracking it down: x$ is much faster than ^x A$ is as slow as ^x $ python3 -m timeit -s "a = 'A'*1" "import re" "re.search('x$', a)" 10 loops, best of 5: 32.9 msec per loop $ python3 -m timeit -s "a =

Re: why sqrt is not a built-in function?

2021-01-16 Thread Michael F. Stemper
On 15/01/2021 17.17, dn wrote: On 16/01/2021 11.40, Michael F. Stemper wrote: On 15/01/2021 16.01, Chris Angelico wrote: On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote:

[issue42939] Linux's chattr i.e. ioctl(FS_IOC_SETFLAGS) is not supported in os.chflags()

2021-01-16 Thread Марк Коренберг
New submission from Марк Коренберг : https://man7.org/linux/man-pages/man2/ioctl_iflags.2.html Seems the ioctl is only way to implement chattr(). I propose to add all these flags to os.chflags() and to gain its support in Linux. -- components: Library (Lib) messages: 385141 nosy:

[issue42935] Pickle can't import builtins at exit

2021-01-16 Thread Pete Wicken
Pete Wicken added the comment: Out of curiosity, why is there not much we can do? I'm not familiar enough with Python's C code to appreciate the difficulty of making the builtins available at the point where the pickle save is run when exiting. The fact that this segfaults in the 3.8

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

2021-01-16 Thread Ross Rhodes
Ross Rhodes added the comment: Hello Charles, Following the format provided, I've opened a PR to implement your proposal. Feedback welcome. -- ___ Python tracker ___

[issue42643] http.server does not support HTTP range requests

2021-01-16 Thread David Bordeynik
Change by David Bordeynik : -- keywords: +patch nosy: +DavidBord nosy_count: 2.0 -> 3.0 pull_requests: +23051 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24228 ___ Python tracker

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

2021-01-16 Thread Ross Rhodes
Change by Ross Rhodes : -- keywords: +patch nosy: +trrhodes nosy_count: 2.0 -> 3.0 pull_requests: +23050 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/24227 ___ Python tracker

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Jan 16, 2021 at 08:59:13AM +, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > ^ matches not just the beginning of the string. It matches the > beginning of a line, i.e. an anchor just after '\n'. Only in MULTILINE mode. I

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

2021-01-16 Thread Charles-François Natali
Change by Charles-François Natali : -- nosy: -neologix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: ^ matches not just the beginning of the string. It matches the beginning of a line, i.e. an anchor just after '\n'. If the input string contains '\n', the result cannot be found less than by linear time. If you want to check if the beginning of the string

[issue42938] ctypes double representation BoF

2021-01-16 Thread Jordy Zomer
New submission from Jordy Zomer : Hi, There's a buffer overflow in the PyCArg_repr() function in _ctypes/callproc.c. The buffer overflow happens due to not checking the length of th sprintf() function on line: case 'd': sprintf(buffer, "", self->tag,