[issue42384] Inconsistent sys.path between python and pdb

2021-01-24 Thread Andrey Bienkowski


Change by Andrey Bienkowski :


--
pull_requests: +23139
pull_request: https://github.com/python/cpython/pull/24320

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42960] resources module, FreeBSD update adding RLIMIT_KQUEUES constant

2021-01-24 Thread Kubilay Kocak


New submission from Kubilay Kocak :

Thank you for the PR David.

If there's anything I can do to help support you with respect to Python on 
FreeBSD (such as accounts on the official freebsd python buildbot workers) let 
me know :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2021-01-24 Thread techfixya


techfixya  added the comment:

How to Install Brother mfc-l2740dw driver on Windows
https://techfixya.com/how-to-install-brother-mfc-l2740dw-driver-on-windows/

--
nosy: +techfixya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Interesting.  I would prefer to make fewer changes per pre-PR branch commit, 
but I see from the doc that I could split changes into at least 4 batches from 
the existing options.  Has this been run/tested on projects better tested than 
IDLE?  Anyway

7. Run pyupgrade.  On Windows, use pyupgrade-directories or try git bash to run 
on idlelib and recurse.

--
stage: patch review -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43020] str.lower method with "İ" character

2021-01-24 Thread Emir

New submission from Emir :

In Turkish there is a character when you capitalize "i" and it's written as 
"İ". When I use str.lower method, it seems like it works just fine because it 
prints the character I expected(i). But the problem is when I compare it to 
normal "i" character (without lowering), the character which is "İ" then became 
"i" has 2 digits(or length) so same words are no more the same. (ex. the word 
"issue" and the word "İssue"-->"issue" are not the same when compared) This is 
a big issue in terms of word counter softwares.

--
components: Build
messages: 385603
nosy: emiryegnidemir7
priority: normal
severity: normal
status: open
title: str.lower method with "İ" character
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43019] wait_for(to_thread)) does not work as expected. Extra documentation or fix needed.

2021-01-24 Thread Felipe Faria


New submission from Felipe Faria :

Consider the following:

```
import asyncio
import time

async def async_test():
while True:
await asyncio.sleep(1)
print("in here - async")

def sync_test():
while True:
time.sleep(1)
print("in here - sync")

async def main():
async def tryexcept(func):
try:
await func
except asyncio.exceptions.TimeoutError:
print("error thrown")

await tryexcept(asyncio.wait_for(async_test(), timeout=5))
await tryexcept(asyncio.wait_for(asyncio.to_thread(sync_test), timeout=5))
print("back in the main thread")

asyncio.run(main())
```

The above will lead to:

```
in here - async
error thrown
in here - sync
error thrown
back in the main thread
in here - sync
in here - sync
in here - sync
[... continues on forever ...]
```

It seems that the new thread created by `to_thread` is never cancelled and 
continues running forever despite the timeout error thrown. This might lead to 
some unwarranted (and hidden) behavior depending on the application.

Frankly, I'm unsure if a possible bug fix is even viable as from my knowledge 
cancelling threads in Python is not recommended. However, if not, I think a 
documentation update would be helpful. 

On my end messing with an existing sync library + `to_thread` + `wait_for` led 
me to believe that the execution had been cancelled, when instead it kept on 
shooting unexpected web requests. 

Thank you.

--
components: asyncio
messages: 385602
nosy: asvetlov, felipefaria, yselivanov
priority: normal
severity: normal
status: open
title: wait_for(to_thread)) does not work as expected. Extra documentation or 
fix needed.
type: behavior
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread Anthony Sottile


Anthony Sottile  added the comment:

just noticed this PR -- you might be interested in pyupgrade which automates 
some of these things -- here's (for example) `git ls-files -- Lib/idlelib | 
grep '\.py$' | xargs pyupgrade --py36-plus

```diff
diff --git a/Lib/idlelib/calltip_w.py b/Lib/idlelib/calltip_w.py
index 1e0404aa49..278546064a 100644
--- a/Lib/idlelib/calltip_w.py
+++ b/Lib/idlelib/calltip_w.py
@@ -25,7 +25,7 @@ def __init__(self, text_widget):
 text_widget: a Text widget with code for which call-tips are desired
 """
 # Note: The Text widget will be accessible as self.anchor_widget
-super(CalltipWindow, self).__init__(text_widget)
+super().__init__(text_widget)
 
 self.label = self.text = None
 self.parenline = self.parencol = self.lastline = None
@@ -54,7 +54,7 @@ def position_window(self):
 return
 self.lastline = curline
 self.anchor_widget.see("insert")
-super(CalltipWindow, self).position_window()
+super().position_window()
 
 def showtip(self, text, parenleft, parenright):
 """Show the call-tip, bind events which will close it and reposition 
it.
@@ -73,7 +73,7 @@ def showtip(self, text, parenleft, parenright):
 self.parenline, self.parencol = map(
 int, self.anchor_widget.index(parenleft).split("."))
 
-super(CalltipWindow, self).showtip()
+super().showtip()
 
 self._bind_events()
 
@@ -143,7 +143,7 @@ def hidetip(self):
 # ValueError may be raised by MultiCall
 pass
 
-super(CalltipWindow, self).hidetip()
+super().hidetip()
 
 def _bind_events(self):
 """Bind event handlers."""
diff --git a/Lib/idlelib/debugger.py b/Lib/idlelib/debugger.py
index ccd03e46e1..53dba376af 100644
--- a/Lib/idlelib/debugger.py
+++ b/Lib/idlelib/debugger.py
@@ -49,9 +49,9 @@ def __frame2message(self, frame):
 filename = code.co_filename
 lineno = frame.f_lineno
 basename = os.path.basename(filename)
-message = "%s:%s" % (basename, lineno)
+message = f"{basename}:{lineno}"
 if code.co_name != "?":
-message = "%s: %s()" % (message, code.co_name)
+message = f"{message}: {code.co_name}()"
 return message
 
 
@@ -213,7 +213,7 @@ def interaction(self, message, frame, info=None):
 m1 = "%s" % str(type)
 if value is not None:
 try:
-m1 = "%s: %s" % (m1, str(value))
+m1 = "{}: {}".format(m1, str(value))
 except:
 pass
 bg = "yellow"
diff --git a/Lib/idlelib/debugobj.py b/Lib/idlelib/debugobj.py
index 5a4c997884..71d01c7070 100644
--- a/Lib/idlelib/debugobj.py
+++ b/Lib/idlelib/debugobj.py
@@ -87,7 +87,7 @@ def GetSubList(self):
 continue
 def setfunction(value, key=key, object=self.object):
 object[key] = value
-item = make_objecttreeitem("%r:" % (key,), value, setfunction)
+item = make_objecttreeitem(f"{key!r}:", value, setfunction)
 sublist.append(item)
 return sublist
 
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index a4d0c95362..5faebb5742 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -37,12 +37,12 @@
 def _sphinx_version():
 "Format sys.version_info to produce the Sphinx version string used to 
install the chm docs"
 major, minor, micro, level, serial = sys.version_info
-release = '%s%s' % (major, minor)
-release += '%s' % (micro,)
+release = f'{major}{minor}'
+release += f'{micro}'
 if level == 'candidate':
-release += 'rc%s' % (serial,)
+release += f'rc{serial}'
 elif level != 'final':
-release += '%s%s' % (level[0], serial)
+release += '{}{}'.format(level[0], serial)
 return release
 
 
@@ -939,7 +939,7 @@ def update_recent_files_list(self, new_file=None):
 rf_list = []
 file_path = self.recent_files_path
 if file_path and os.path.exists(file_path):
-with open(file_path, 'r',
+with open(file_path,
   encoding='utf_8', errors='replace') as rf_list_file:
 rf_list = rf_list_file.readlines()
 if new_file:
@@ -1446,7 +1446,7 @@ def newline_and_indent_event(self, event):
 else:
 self.reindent_to(y.compute_backslash_indent())
 else:
-assert 0, "bogus continuation type %r" % (c,)
+assert 0, f"bogus continuation type {c!r}"
 return "break"
 
 # This line starts a brand new statement; indent relative to
diff --git a/Lib/idlelib/filelist.py b/Lib/idlelib/filelist.py
index 0d200854ef..9b863698a0 100644
--- a/Lib/idlelib/filelist.py
+++ b/Lib/idlelib/filelist.py
@@ -22,7 +22,7 @@ def open(self, filename, 

[issue42977] Tkinter Optionmenu Too Narrow on Mac

2021-01-24 Thread DDavid


DDavid  added the comment:

Thanks for your help! I agree that it is probably a Tk issue. I will contact 
them and back with more information.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42948] bytearray.copy is undocumented

2021-01-24 Thread wim glenn


wim glenn  added the comment:

Oh, I've missed that part. Although the note (5) seems to indicate that the 
copy method refers to sequence types which don't support slicing, it still 
seems adequately documented under the mutable sequence operations.

I'll close this.

--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41962] Make threading._register_atexit public?

2021-01-24 Thread Ben Darnell


Ben Darnell  added the comment:

> IMO, a better practice would be providing those potentially infinite running 
> tasks a direct method of escape and invoking it before calling 
> executor.shutdown(), it would be a more reliable approach.

Agreed, but the problem is that I'm in a library (so I don't control the main 
module), and the library's interface does not mandate any sort of explicit 
shutdown method. There is a shutdown method, but almost no one calls it, and 
it's never caused a problem until Python 3.9 changed things so it deadlocks. 

> My only concern is that it might be a potential foot-gun. If the user submits 
> an atexit hook that deadlocks, it might prevent threads from shutting down 
> safely prior to interpreter finalization. 

Yes, and that is exactly the problem. concurrent.futures submits an atexit hook 
whose behavior depends on application code, and through that I have 
inadvertently caused a deadlock.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35523] Remove old ctypes callback workaround: creating the first instance of a callback

2021-01-24 Thread Campbell Barton


Campbell Barton  added the comment:

Note, this bug is something we ran into in Blender, see: 
https://developer.blender.org/T84752

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35523] Remove old ctypes callback workaround: creating the first instance of a callback

2021-01-24 Thread Campbell Barton


Campbell Barton  added the comment:

Could this fix be applied to Python 3.7x?

Currently the visual effects platform for 2021 is using Python 3.7.x, see: 
https://vfxplatform.com

Which means anyone using the VFX platform can run into this bug.

--
nosy: +ideasman42

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread miss-islington


miss-islington  added the comment:


New changeset ff06957710aa849f3402b082a7ddd34b0325d6de by Miss Islington (bot) 
in branch '3.9':
bpo-43013: Update idlelib code to 3.x  (GH-24315)
https://github.com/python/cpython/commit/ff06957710aa849f3402b082a7ddd34b0325d6de


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23138
pull_request: https://github.com/python/cpython/pull/24319

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2021-01-24 Thread Berker Peksag


Berker Peksag  added the comment:

Copying my comment from GitHub:

> I think DICOM is too specific to be added to the stdlib. I'd prefer
> improving documentation of imghdr.tests to make adding custom file
> types clearer.

--
nosy: +berker.peksag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 63ebba0d9430a0bc18fd8551ad27b9b25709a4be by Miss Islington (bot) 
in branch '3.8':
bpo-43013: Update idlelib code to 3.x  (GH-24315) (#24317)
https://github.com/python/cpython/commit/63ebba0d9430a0bc18fd8551ad27b9b25709a4be


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33289] tkinter askcolor returning floats for r, g, b values instead of ints

2021-01-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +23137
pull_request: https://github.com/python/cpython/pull/24318

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43018] unwanted label showing up in ttk.LabeledScale

2021-01-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It has already been fixed in issue40219. Just wait next bugfix release.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
superseder:  -> ttk LabeledScale: label covered by hidden element

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43018] unwanted label showing up in ttk.LabeledScale

2021-01-24 Thread Akuli


New submission from Akuli :

import tkinter
from tkinter import ttk
root = tkinter.Tk()
ttk.LabeledScale(root).pack()
root.mainloop()


Run this code and move the slider to center. You see something in front of the 
number. The problem is this line in ttk.py:

tmp = Label(self).pack(side=label_side) # place holder

I tried deleting it, but then the label doesn't show up at all, and what 
remains is just a scale. Packing with a different side works, but that feels 
like a hack.

--
components: Tkinter
files: .png
messages: 385591
nosy: Akuli
priority: normal
severity: normal
status: open
title: unwanted label showing up in ttk.LabeledScale
versions: Python 3.9
Added file: https://bugs.python.org/file49765/.png

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-01-24 Thread Éric Araujo

Éric Araujo  added the comment:

Senthil, what is your opinion here?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41962] Make threading._register_atexit public?

2021-01-24 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I'm dealing with a subtle deadlock involving 
> concurrent.futures.ThreadPoolExecutor, and my solution that worked in Python 
> 3.8 broke with 3.9. I'm running some long-running (possibly infinite) tasks 
> in the thread pool, and I cancel them in an `atexit` callback so that 
> everything can shut down cleanly (before ThreadPoolExecutor joins all worker 
> threads in its own `atexit` hook).

IMO, a better practice would be providing those potentially infinite running 
tasks a direct method of escape and invoking it before calling 
executor.shutdown(), it would be a more reliable approach. But, perhaps there 
is some convenience utility in being able to provide custom atexit hooks. It 
also might help the user to separate the shutdown logic from the rest of the 
program. 

Since you worked with me in adding threading._register_atexit(), Do you have 
any thoughts, Antoine? I would personally not be opposed to it being made 
public assuming there's real utility present in doing so.

My only concern is that it might be a potential foot-gun. If the user submits 
an atexit hook that deadlocks, it might prevent threads from shutting down 
safely prior to interpreter finalization. I'm presently undecided if explicitly 
mentioning that it in the docs would be sufficient warning.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 8dfe15625e6ea4357a13fec7989a0e6ba2bf1359 by Terry Jan Reedy in 
branch 'master':
 bpo-43013: Update idlelib code to 3.x  (GH-24315)
https://github.com/python/cpython/commit/8dfe15625e6ea4357a13fec7989a0e6ba2bf1359


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23136
pull_request: https://github.com/python/cpython/pull/24317

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +23135
pull_request: https://github.com/python/cpython/pull/24316

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +23134
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24315

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43013] IDLE: update code, mostly by cleanups of 2.x or 2to3 artifacts

2021-01-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Delete 2. 'list' is needed if for-suite mutates the dict all 6 either directly 
or maybe indirectly do so.  Not worth checking unless otherwise editing the 
function.

6. N unneeded .keys() (out of 13 occurrences) when iterating dict.  Low 
priority.

First patch does 1. and 5.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43017] Improve error message in the parser when using un-parenthesised tuples in comprehensions

2021-01-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +23133
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24314

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43017] Improve error message in the parser when using un-parenthesised tuples in comprehensions

2021-01-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +lys.nikolaou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43017] Improve error message in the parser when using un-parenthesised tuples in comprehensions

2021-01-24 Thread Pablo Galindo Salgado

New submission from Pablo Galindo Salgado :

I have seen this confusion many users over the years. Instead of showing:

❯ python -c '[x,z for x,y in something]'
  File "", line 1
[x,z for x,y in something]
 ^
SyntaxError: invalid syntax

We can show:

❯ ./python -c '[x,z for x,y in something]'
  File "", line 1
[x,z for x,y in something]
 ^
SyntaxError: did you forgot parentheses around the comprehension target?

--
messages: 385586
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Improve error message in the parser when using un-parenthesised tuples 
in comprehensions

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal
nosy_count: 4.0 -> 5.0
pull_requests: +23132
pull_request: https://github.com/python/cpython/pull/24313

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-01-24 Thread Adam Goldschmidt

Adam Goldschmidt  added the comment:

> The difference is that semicolon is defined in a previous specification.

I understand, but this will limit us in the future if the spec changes - though 
I don't have strong feelings regarding this one.

> Dear all, now that Adam has signed the CLA, I have closed my PR in favor of 
> Adam's because I think 2 open PRs might split everyone's attention. Instead, 
> I'll focus on reviewing Adam's PR. Sorry for any inconvenience caused.

❤

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41962] Make threading._register_atexit public?

2021-01-24 Thread Irit Katriel


Change by Irit Katriel :


--
components: +Library (Lib)
nosy: +aeros, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42647] Unable to use concurrent.futures in atexit hook

2021-01-24 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +aeros

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42647] Unable to use concurrent.futures in atexit hook

2021-01-24 Thread Irit Katriel


Irit Katriel  added the comment:

b61b818d916942aad1f8f3e33181801c4a1ed14b is the first bad commit
commit b61b818d916942aad1f8f3e33181801c4a1ed14b
Author: Kyle Stanley 
Date:   Fri Mar 27 15:31:22 2020 -0400

bpo-39812: Remove daemon threads in concurrent.futures (GH-19149)

Remove daemon threads from :mod:`concurrent.futures` by adding
an internal `threading._register_atexit()`, which calls registered functions
prior to joining all non-daemon threads. This allows for compatibility
with subinterpreters, which don't support daemon threads.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43016] Improve tests for curses

2021-01-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +23131
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24312

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43016] Improve tests for curses

2021-01-24 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently tests for curses mainly call different functions and methods in 
random order. Not all argument combinations are covered by tests and results 
are not checked. I also ran tests with 1750 different values of TERM supported 
by ncurses, and some tests were failed because not all features are supported 
on all terminals.

The proposed PR rewrites tests for curses.

* Added tests for every function or group of related functions.

* Added separate tests for optional functions, so that skipped tests are shown 
it output.

* Optionally skipped tests for functions like beep() and flush() which do not 
supported an all terminals (surprisingly!).

* Every function which takes variable number of arguments is now tested with 
all combination of arguments.

* Functions which support different types of argument (str/bytes/int) are now 
tested with all supported types.

* Function which change the global state are now called in order which restores 
presumably default value.

* Checked values and types of results of functions.

* Some tests serve role of demos. They call some function in some order and 
check how it affects results of other functions.

* Tests now work on terminals with small size (15 lines or less). Some 
terminals have very small default size.

It could still be improved (for example not all functions are tested with 
non-ASCII strings), but I spent several weekends (including a New Year and both 
Christmases) on this work and want to take a break.

--
components: Tests
messages: 385583
nosy: serhiy.storchaka, twouters
priority: normal
severity: normal
status: open
title: Improve tests for curses
type: enhancement
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-01-24 Thread Ken Jin


Ken Jin  added the comment:

Dear all, now that Adam has signed the CLA, I have closed my PR in favor of 
Adam's because I think 2 open PRs might split everyone's attention. Instead, 
I'll focus on reviewing Adam's PR. Sorry for any inconvenience caused.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43015] Add str.replaceall?

2021-01-24 Thread Nathaniel Manista


New submission from Nathaniel Manista :

Chained str.replace calls can sometimes be pretty unattractive; what are the 
chances that we could have an str.replaceall method? Of type 
Callable[[Mapping[str, str]], str]?

Check out absl::StrReplaceAll 
(https://github.com/abseil/abseil-cpp/blob/22771d471930ce88e1e75d0ca9dd8c65a7b0f895/absl/strings/str_replace.h#L73-L98)
 for a similarly useful function in C++.

--
components: Unicode
messages: 385581
nosy: Nathaniel Manista, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: Add str.replaceall?
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42565] Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined

2021-01-24 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42743] pdb vanishing breakpoints

2021-01-24 Thread Irit Katriel


Irit Katriel  added the comment:

Daniel, can you provide a recipe to reproduce what you are seeing? There are 
different ways to enter pdb, and different ways to set breakpoints. If you 
provide accurate instructions it will help to be sure that the issue has indeed 
been fixed.

--
components: +Library (Lib)
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42992] Tkinter bbox coordinates incorrectly drawn

2021-01-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Even if there is something wrong with the returned values, Tkinter is just 
mostly a thin wrap around Tk. It does not change the returned value, it just 
converts it to appropriate Python type (a tuple of 4 integers (4, 4, 101, 101) 
instead of a string "4 4 101 101").

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42977] Tkinter Optionmenu Too Narrow on Mac

2021-01-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with E. Paine that you should use pack(fill="x") if you want to 
stretch a widget. And in any case Tkinter itself does not manage layout, it is 
just a wrapper around Tk, so if you think that the default layout of a button 
is wrong on some platforms, you should report it to the Tk team.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

re.compile() already uses caching. But it is less efficient for some reasons.

To Steven: the time is *reduced* by 28%, but the speed is *increased* by 39%.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Just for the record:

> The optimization takes the execution from ~6300ms to ~4500ms on my machine 
> (representing a 28% - 39% improvement depending on how you calculate it)

The correct answer is 28%, which uses the initial value as the base: 
(6300-4500)/6300 ≈ 28%. You are starting at 6300ms and speeding it up by 28%:

>>> 6300 - 28/100*6300
4536.0

Using 4500 as the base would only make sense if you were calculating a slowdown 
from 4500ms to 6300ms: we started at 4500 and *increase* the time by 39%:

>>> 4500 + 39/100*4500
6255.0


Hope this helps.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset 15bd9efd01e44087664e78bf766865a6d2e06626 by Anthony Sottile in 
branch 'master':
bpo-43014: Improve performance of tokenize.tokenize by 20-30%
https://github.com/python/cpython/commit/15bd9efd01e44087664e78bf766865a6d2e06626


--
nosy: +BTaskaya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


Anthony Sottile  added the comment:

attached out3.pstats / out3.svg which represent the optimization using 
lru_cache instead

--
Added file: https://bugs.python.org/file49764/out3.svg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


Change by Anthony Sottile :


Added file: https://bugs.python.org/file49763/out3.pstats

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


Anthony Sottile  added the comment:

admittedly anecdotal but here's another data point in addition to the profiles 
attached

test.test_tokenize suite before:

$ ./python -m test.test_tokenize
..
--
Ran 78 tests in 77.148s

OK


test.test_tokenize suite after:

$ ./python -m test.test_tokenize
..
--
Ran 78 tests in 61.269s

OK

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch
pull_requests: +23130
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24311

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


Change by Anthony Sottile :


Added file: https://bugs.python.org/file49762/out2.svg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


Change by Anthony Sottile :


Added file: https://bugs.python.org/file49761/out2.pstats

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


Change by Anthony Sottile :


Added file: https://bugs.python.org/file49760/out.svg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Anthony Sottile


New submission from Anthony Sottile :

I did some profiling (attached a few files here with svgs) of running this 
script:

```python
import io
import tokenize

# picked as the second longest file in cpython
with open('Lib/test/test_socket.py', 'rb') as f:
bio = io.BytesIO(f.read())


def main():
for _ in range(10):
bio.seek(0)
for _ in tokenize.tokenize(bio.readline):
pass

if __name__ == '__main__':
exit(main())
```


the first profile is before the optimization, the second is after the 
optimization

The optimization takes the execution from ~6300ms to ~4500ms on my machine 
(representing a 28% - 39% improvement depending on how you calculate it)

(I'll attach the pstats and svgs after creation, seems I can only attach one 
file at once)

--
components: Library (Lib)
files: out.pstats
messages: 385572
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: tokenize spends a lot of time in `re.compile(...)`
type: performance
versions: Python 3.10, Python 3.9
Added file: https://bugs.python.org/file49759/out.pstats

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com