[issue43411] wm_manage fails with ttk.Frame

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

As an IDLE maintainer, I am a tkinter user also and that is my involvement in 
tkinter changes.  One of my projects for IDLE has been to switch to ttk 
widgets, including ttk.Frame, wherever possible, for the reasons you gave.

It is known the tkinter docs we control are quite inadequate, and dependent on 
outside docs that we do not control.  That is why the tkinter doc starts with 7 
references for tkinter and 5 for tcl/tk.  I am sorry that you fell into one of 
the gaps.  But no one has yet volunteered to rewrite the tkinter/ttk docs to be 
complete, correct, and not dependent on outside resources.  Until then, I do 
not see a good place to put the note you request.  What would you say, and more 
important, where?

wm_manage is an anomaly for at least two reasons.  The tk docs define the wm 
call sequences as "'wm'  atoplevel ".  This 
translates to tkinters calls "atoplevel.wm_subcommand(subcommand_args)", where 
'atoplevel' is the self arg for the call.  The tk doc contradicts itself by 
saying that for wm_manage, atoplevel can instead be a *frame* or *labelframe* 
(** indicates italics in the tk docs).  For tkinter, this translate to 
aframe.wm_manage(), but this is impossible since Frames do not subclass the Wm 
class, nor are they given this one method.  It also turns out that 
atoplevel.wm_manage() does not work either.

Instead, one must call atoplevel.wm_manage(toplevel_frame_or_labelframe).  This 
would roughly be equivalent, in tk, to "'wm' 'manage' atoplevel 
toplevel_frame_or_labelframe". 

Another anomaly is that wm_manage is not really needed, at least not for 
frames.  On can create a toplevel and pack a frame of any type that fills the 
toplevel.  (Yes, a bit more work.)

--

___
Python tracker 

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



[issue43473] Junks in difflib

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Currently return tuple (i, j, n), means that a[i:i+n] == b[j:j+n], where both 
matching blocks are the same length.
https://docs.python.org/3/library/difflib.html#difflib.SequenceMatcher.get_matching_blocks

This would not be the case if a has an ignored space and b does not. Changing 
the current definition would break existing code and would require quadruples 
to return two different lengths.  This would require either a new parameter for 
the function to select the behavior or a new function with a new name.

Either option would require justification by actual use cases.  I cannot see 
what they might be.  An way to have junk chars completely ignored is to strip 
them from both strings before calling SequenceMatcher.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue43214] site: Potential UnicodeDecodeError when handling pth file

2021-03-12 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue43214] site: Potential UnicodeDecodeError when handling pth file

2021-03-12 Thread Inada Naoki


Change by Inada Naoki :


--
superseder:  -> Use io.open_code for .pth files

___
Python tracker 

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



[issue23633] Improve py launcher help, index, and doc

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

The current help text attempts to explain point 2, in terms of an active 
virtual environment, shebangs, the PY_PYTHON[2|3] environment variables, and 
the py.ini [defaults]. It's a lot to say succinctly in a few lines of text. A 
shortened URL that links to the docs would be helpful.

The -0[p] listing uses an asterisk to highlight the version that `py` runs 
without a version specified in the command line or if a script has no shebang.

For point 3, referencing CSIDL_LOCAL_APPDATA in the documentation is not useful 
for people who aren't familiar with the Windows shell API. The help text from 
py.exe uses "%LOCALAPPDATA%\py.ini", which is more useful at the command line. 
It also explains how to locate py.ini in the launcher directory by using `where 
py`. However, a lot of people use PowerShell nowadays, in which case it has to 
be `where.exe py` or `gcm py | select source`.

--
assignee:  -> docs@python
components: +Documentation, Windows
nosy: +docs@python, paul.moore, tim.golden, zach.ware
type: behavior -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5

___
Python tracker 

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



[issue36880] Returning None from a callback with restype py_object decrements None's refcount too much

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
versions: +Python 3.10, Python 3.9 -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue26362] Approved API for creating a temporary file path

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

> So no, while unresolved, this bug report should not be closed.

The implied question was whether you or the core devs on the nosy list, upon 
further consideration, wanted to resolve the issue by rejecting the request, 
but it had simply been forgotten about for 4 years.

--

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-12 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +23601
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24836

___
Python tracker 

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



[issue43468] functools.cached_property locking is plain wrong.

2021-03-12 Thread Antti Haapala


Antti Haapala  added the comment:

I've been giving thought to implementing the locking on the instance or per 
instance instead, and there are bad and worse ideas like inserting per 
(instance, descriptor) into the instance `__dict__`, guarded by the 
per-descriptor lock; using a per-descriptor `WeakKeyDictionary` to map the 
instance to locks (which would of course not work - is there any way to map 
unhashable instances weakly?)

So far best ideas that I have heard from others or discovered myself are along 
the lines of "remove locking altogether" (breaks compatibility); "add 
`thread_unsafe` keyword argument" with documentation saying that this is what 
you want to use if you're actually running threads; "implement Java-style 
object monitors and synchronized methods in CPython and use those instead"; or 
"create yet another method".

--

___
Python tracker 

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



[issue23835] configparser does not convert defaults to strings

2021-03-12 Thread junyixie


Change by junyixie :


--
nosy: +JunyiXie
nosy_count: 7.0 -> 8.0
pull_requests: +23600
pull_request: https://github.com/python/cpython/pull/24821

___
Python tracker 

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



[issue43420] Optimize rational arithmetics

2021-03-12 Thread Sergey B Kirpichev


Sergey B Kirpichev  added the comment:

> a short paragraph or section on alternative implementations

There are no alternative implementations.  SymPy's PythonRational (AFAIR, this 
class not in the default namespace) is an internal fallback solution, for case 
when no gmpy2 is available.

Maybe we should list gmpy2 everywhere people expect fast bigint/rationals (i.e. 
int docs, math module, Fraction and so on), so they will not not be 
disappointed...

> complexity (and assured correctness)

Much more complex (IMHO) code was accepted (there were examples for C, but the 
limit_denominator() method - an example for Python code, from the same module!).

In fact, it pretty obvious that output fractions are equal to the middle-school 
versions.  Non-trivial part may be why they are normalized.  I hope, now this 
covered by comments.

--

___
Python tracker 

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



[issue43420] Optimize rational arithmetics

2021-03-12 Thread Tim Peters


Tim Peters  added the comment:

Terry, we could do that, but the opposition here isn't strong, and is pretty 
baffling anyway ;-) : the suggested changes are utterly ordinary for 
implementations of rationals, require very little code, are not delicate, and 
are actually straightforward to see are correct (although unfamiliarity can be 
an initial barrier - e.g., if you don't already know that after

 g = gcd(a, b)
 a1 = a // g
 b1 = b // g

it's necessarily true that a1 and b1 are coprime, a key reason for way the 
transformation is correct will be lost on you - but it's also very easy to 
prove that claim once you're told that it is a key here). The OP is right that 
"we" (at least Mark, and Raymond, and I) have routinely checked in far subtler 
optimizations in various areas.

--

___
Python tracker 

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



[issue34840] dlopen() error with no error message from dlerror()

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> not a bug
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



[issue19217] Calling assertEquals for moderately long list takes too long

2021-03-12 Thread Zachary Ware


Change by Zachary Ware :


--
hgrepos:  -401

___
Python tracker 

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



[issue43485] Spam

2021-03-12 Thread Zachary Ware


Change by Zachary Ware :


--
hgrepos:  -400

___
Python tracker 

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



[issue43485] Spam

2021-03-12 Thread Zachary Ware


Change by Zachary Ware :


--
hgrepos:  -399

___
Python tracker 

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



[issue43485] Spam

2021-03-12 Thread Zachary Ware


New submission from Zachary Ware :

You appear to be just creating spam, so I've removed your ability to make any 
changes to bugs.python.org.  If you feel this was done in error, please bring 
it up on discuss.python.org.

--
assignee: docs@python -> 
components:  -2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
FreeBSD, IDLE, IO, Installation, Interpreter Core, Library (Lib), Regular 
Expressions, SSL, Subinterpreters, Tests, Tkinter, Unicode, Windows, XML, 
asyncio, ctypes, email
nosy:  -Alex.Willmer, asvetlov, barry, docs@python, dstufft, eric.araujo, 
ezio.melotti, koobs, larry, mrabarnett, paul.moore, r.david.murray, 
steve.dower, terry.reedy, tim.golden, vstinner, yselivanov
resolution: works for me -> not a bug
stage:  -> resolved
status: open -> closed
title: devturks -> Spam
type: resource usage -> 
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



[issue19217] Calling assertEquals for moderately long list takes too long

2021-03-12 Thread Kadir SELÇUK

Change by Kadir SELÇUK :


--
hgrepos: +401

___
Python tracker 

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



[issue26362] Approved API for creating a temporary file path

2021-03-12 Thread Ben Finney


Ben Finney  added the comment:

> tempfile.mktemp() still exists and works without raising a deprecation 
> warning. Of course it's still marked as deprecated in the docs.

Right. So, the issue is not resolved: Functionality to create a temporary file 
path is maintained in the standard library (good) but the public API for it is 
unsupported.

> Does anyone still want this tempfile.makepath() function?

That's a proposed name. But yes, a supported function in the `tempfile` 
standard library module, which does what's described in this issue.

> Or can this issue be closed?

The issue remains unresolved. Unless you can point us to something new which 
resolves this?

So no, while unresolved, this bug report should not be closed.

--

___
Python tracker 

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



[issue43485] devturks

2021-03-12 Thread Kadir SELÇUK

Change by Kadir SELÇUK :


--
hgrepos: +400

___
Python tracker 

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



[issue43485] devturks

2021-03-12 Thread Kadir SELÇUK

Change by Kadir SELÇUK :


--
resolution:  -> works for me

___
Python tracker 

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



[issue43485] devturks

2021-03-12 Thread Kadir SELÇUK

Change by Kadir SELÇUK :


--
assignee: docs@python
components: 2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
FreeBSD, IDLE, IO, Installation, Interpreter Core, Library (Lib), Regular 
Expressions, SSL, Subinterpreters, Tests, Tkinter, Unicode, Windows, XML, 
asyncio, ctypes, email
hgrepos: 399
nosy: Alex.Willmer, asvetlov, barry, docs@python, dstufft, eric.araujo, 
ezio.melotti, koobs, larry, mrabarnett, paul.moore, post.kadirselcuk, 
r.david.murray, steve.dower, terry.reedy, tim.golden, vstinner, yselivanov, 
zach.ware
priority: normal
severity: normal
status: open
title: devturks
type: resource usage
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



[issue43477] from x import * behavior inconsistent between module types.

2021-03-12 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +brett.cannon, eric.smith

___
Python tracker 

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



[issue30435] Documentation either unclear or incorrect on comparisons between bytes and strings in Python 3

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
type: behavior -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue43484] we can create valid datetime objects that become invalid if the timezone is changed

2021-03-12 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +belopolsky, lemburg, p-ganssle

___
Python tracker 

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



[issue18017] ctypes.PyDLL documentation

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

I think the documentation of ctypes.PyDLL and ctypes.pythonapi is good enough 
as is.

--
resolution:  -> rejected
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



[issue29688] Add support for Path.absolute()

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
assignee:  -> docs@python
components: +Library (Lib)
type:  -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue26362] Approved API for creating a temporary file path

2021-03-12 Thread Eryk Sun

Eryk Sun  added the comment:

> The proposal in this issue is to have a public standard library API,
> which I'm calling ‘tempfile.makepath’,

It's a few years later, and tempfile.mktemp() still exists and works without 
raising a deprecation warning. Of course it's still marked as deprecated in the 
docs. Does anyone still want this tempfile.makepath() function? Or can this 
issue be closed?

--
type: behavior -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue43484] we can create valid datetime objects that become invalid if the timezone is changed

2021-03-12 Thread mike bayer


New submission from mike bayer :

So I'm pretty sure this is "not a bug" but it's a bit of a problem and I have a 
user suggesting the "security vulnerability" bell on this one, and to be honest 
I don't even know what any library would do to "prevent" this.

Basically, the datetime() object limits based on a numerical year of MINYEAR, 
rather than limiting based on an actual logical date.

So I can create an "impossible" date as follows:


d = datetime.strptime("Mon Jan  1 00:00:00 0001 +01:00", "%c %z")

or like this:

d = datetime(year=1, month=1, day=1, tzinfo=timezone(timedelta(hours=1)))

andyou can see where this is going - it can't be converted to a timezone 
that pushes the year to zero:

>>> from datetime import datetime, timezone, timedelta
>>> d = datetime(year=1, month=1, day=1, tzinfo=timezone(timedelta(hours=1)))
>>> d.astimezone(timezone.utc)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: date value out of range

this because, after all, astimezone() is just subraction or addition and if it 
overflows past the artificial boundary, well you're out of luck.

Why's this a security problem?   ish?because PostgreSQL has a data type 
"TIMESTAMP WITH TIMEZONE" and if you take said date and INSERT it into your 
database, then SELECT it back using any Python DBAPI that returns datetime() 
objects like psycopg2, if your server is in a timezone with zero or negative 
offset compared to the given date, you get an error.  So the mischievous user 
can create that datetime for some reason and now they've broken your website 
which can't SELECT that table anymore without crashing.

So, suppose you maintain the database library that helps people send data in 
and out of psycopg2.We have, the end user's application, we have the 
database abstraction library, we have the psycopg2 driver, we have Python's 
datetime() object with MIN_YEAR, and finally we have PostgreSQL with the 
TIMEZONE WITH TIMESTAMP datatype that I've never liked.

Of those five roles, whose bug is this?I'd like to say it's the end user 
for letting untrusted input that can put unusual timezones and timestamps in 
their system.   But at the same time it's a little weird Python is letting me 
create this date that lacks the ability to convert into UTC. thanks for 
reading!

--
components: Library (Lib)
messages: 388585
nosy: zzzeek
priority: normal
severity: normal
status: open
title: we can create valid datetime objects that become invalid if the timezone 
is changed
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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-12 Thread Brandt Bucher

Brandt Bucher  added the comment:

Yup, I agree we should explore this area further. See my comment here on 
Adrian’s mypy PR:

https://github.com/python/mypy/pull/10191#issuecomment-797841945

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

This does point out that the ast structure is a liability, and we won't be
able to easily change it, since mypy and IIRC many linters use the ast
module. So I think that maybe we need to think more carefully about what
the *proper* ast structure is, rather than what was most convenient for the
initial implementation. (Brandt, I know you are reluctant to change this,
and I don't blame you, but nevertheless I think we should at least think
about this some more so we're not stuck with a sub-optimal "default"
solution. We've already won the war. Let's not lose the battle. :-)

--

___
Python tracker 

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



[issue43483] Loss of content in simple (but oversize) SAX parsing

2021-03-12 Thread Larry Trammell


New submission from Larry Trammell :

== The Problem ==

I have observed a "loss of data" problem using the Python SAX parser, when 
processing an oversize but very simple machine-generated xhtml file. The file 
represents a single N x 11 data table.  W3C "tidy" reports no xml errors.  The 
table is constructed in an entirely plausible manner, using table, tr, and td 
tags to define the table structure, and p tags to bracket content, which 
consists of small chunks of quoted text.  There is nothing pathological, no 
extraneous whitespace characters, no empty data fields. 

Everything works perfectly in small test cases.  But when a very large number 
of rows are present, a few characters of content strings are occasionally lost. 
I have observed 2 or 6 characters dropped.  But here's the strange part.  The 
pathological behavior disappears (or moves to another location) when one or 
more non-significant whitespace characters are inserted at an arbitrary 
location early in the file... e.g. an extra linefeed before the first tr tag. 

== Context ==

I have observed identical behavior on desktop systems using an Intel Xeon 
E5-1607 or a Core-2 processor, running 32-bit or 64-bit Linux operating 
systems, variously using Python 3.8.5, 3.8, 3.7.3, and 3.5.1.

== Observing the Problem == 

Sorry that the test data is so bulky (even at 0.5% of original size), but bulk 
appears to be a necessary condition to observe the problem. Run the following 
command line.  

python3  EnchXMLTest.py  EnchTestData.html 

The test script invokes the SAX parser and generates messages on stdout. Using 
the original test data as provided, the test should run correctly to 
completion.  Now modify the test data file, deleting the extraneous comment 
line (there is only one) found near the top of the file.  Repeat the test run, 
and this time look for missing content characters in parsed content fields of 
the last record.  
 
== Any guesses? ==

Beyond "user is oblivious," possibly something abnormal can occur at seams 
between large blocks of buffered text.  The presence or absence of an extra 
character early in the data stream results in a corresponding shift in content 
location at the end of the buffer.  Other clues: is it relevant that the 
problem appears in a string field that contains slash characters?

--
components: XML
files: EnchSAXTest.zip
messages: 388582
nosy: ridgerat1611
priority: normal
severity: normal
status: open
title: Loss of content in simple (but oversize) SAX parsing
type: behavior
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49872/EnchSAXTest.zip

___
Python tracker 

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



[issue43462] canvas.bbox returns None on 'hidden' items while coords doesn't

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

(You don't use coords('tunnel') above because it only reports on the 'first' 
tagged object.)

tkinter widget methods are generally thin wrappers around tk functions that 
translate between python objects and tk strings.

I believe that this should be closed as '3rd party' or 'not a bug'.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-12 Thread Brandt Bucher


Brandt Bucher  added the comment:

Not a much thought went into that decision, honestly.

The main reason I chose an identifier there was because "as" always stores a 
simple name, so allowing it to potentially be other contexts or expressions 
(which are illegal) just seemed to create complexity. I saw we used simple 
identifiers in many similar places and just went with it.

(As a related note, if mapping patterns had their own AST nodes, I would 
probably choose to represent "**rest" as an optional identifier, rather than a 
keyless value or optional Name.)

If it causes problems for clients of the AST, it's easy to change. But I sort 
of like it a bit better how it is now.

--

___
Python tracker 

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



[issue43475] Worst-case behaviour of hash collision with float NaN

2021-03-12 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Idea:  We could make this problem go away by making NaN a singleton.

--

___
Python tracker 

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



[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2021-03-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

If we add a new flag to ignore errors it's difficult to write code that
works in 3.9 as well. And given the use case I have doubts that "Errors
should never pass silently" is really the right Zen line to focus on. I'd
rather go for "Simple is better than complex" or "practicality beats
purity".

--

___
Python tracker 

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



[issue43411] wm_manage fails with ttk.Frame

2021-03-12 Thread Martin Cooper


Martin Cooper  added the comment:

I think you are confusing the perspective of the implementor with that of the 
typical developer _using_ the toolkit without reading through its source code.

In my tkinter applications, I pretty much always use ttk widgets where they are 
available. This is largely because of the consistent background colour (on a 
Mac, at least). In the case of Frame specifically, a regular Frame has a white 
background that doesn't go well with ttk widgets, while a ttk.Frame has a grey 
background. So naturally, when I started trying to implement a pop-out window, 
I was using ttk.Frame everywhere.

Then, when I started getting the error cited above, telling me that ".!frame" 
was not a frame, I was more than a little perplexed. Because in my view, I 
*had* a frame. I don't really care what the widget's unique name is, contrary 
to your suggestion that I'm confused by it. If I had given my ttk.Frame the 
name "garply", and the error was '".garply" is not manageable: must be a frame, 
labelframe or toplevel', I would have looked back at my code, and seen that, 
yep, garply was indeed a ttk.Frame, so what's the problem?

It took me a long time to figure out that only a tkinter Frame, and not a ttk 
Frame, will work with wm_manage() (disregarding labelframe and toplevel in this 
context). Because as a regular developer using the library, it simply wasn't at 
all clear that using a ttk.Frame is fundamentally different under the covers, 
and isn't actually considered to be a frame for the purposes of wm_manage(). 
Who'd have thought? Seriously. Regular developers naturally assume that ttk 
components are a kind of specialised version of their non-ttk counterparts, 
albeit with different options and style support, rather than a parallel world. 
You noted that "Our ttk doc does not discuss the ttk widgets that are 
essentially copies of tk widgets  except the mostly documented differences". I 
think it *would* be worthwhile to say something about the fact that these are 
parallel components, and not derivatives, because, as this issue clearly 
illustrates, it can be important to understand this.

I even read through the tkinter and ttk source code to try to understand what 
was going on. The doc string for wm_manage() would have been a good place to 
say something, but there's nothing. I do understand that that is outside of ttk 
per se, but still, the two are not so separate that a comment couldn't help 
explain the constraint, and it really is important to the use of this method to 
understand that a ttk Frame is not a Frame.

It's unfortunate that the readable names used in the path aren't different for 
tkinter and ttk widgets, especially given how different they are. That would 
have helped. I realise, though, that changing it now is likely not a viable 
option.

In the end it was a hunch, perhaps born out of desperation and a lack of 
anything else to try, that led me to discover that a ttk Frame is not a Frame. 
I wasted a lot of time on this. I filed this issue in the hope that some 
documentation might be added so that others like myself don't also have to 
waste their time.

--

___
Python tracker 

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



[issue43461] Tottime column for cprofile output does not add up

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

An actual example might help get an answer.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue27820] Possible bug in smtplib when initial_response_ok=False

2021-03-12 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
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



[issue27820] Possible bug in smtplib when initial_response_ok=False

2021-03-12 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset 8cadc2c9cacfa1710cb5ca28a70f7782cacf09aa by Senthil Kumaran in 
branch '3.8':
[3.8] bpo-27820: Fix AUTH LOGIN logic in smtplib.SMTP (GH-24118) (#24833)
https://github.com/python/cpython/commit/8cadc2c9cacfa1710cb5ca28a70f7782cacf09aa


--

___
Python tracker 

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



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

2021-03-12 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Petr, 

On 

> the `separator` argument now allows multi-character strings, so you can parse 
> 'a=1b=2' with separator=''. Was this intentional?

No, this was not intentional. The separator arg was just coice, for  
compatibility, if some wanted to use `;` like the some URLs that were shared as 
use case. We didn't restrict about what was allowed or length of the separator.

--

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I think I prefer to raise a single event, because it match more closely the 
actual call, is a bit faster and more straighfoward. I will create a PR soon

--

___
Python tracker 

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



[issue43425] test_peg_generator.test_c_parser emits DeprecationWarning due to distutils

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Steve, PEP 632 lacks a reference to the SC acceptance thereof.  Could you add 
one?
https://mail.python.org/archives/list/python-...@python.org/thread/TXU6TVOMBLQU3SV57DMMOA5Y2E67AW7P/
And can you verify my interpretation below?

The warning is correct as to removal.  PEP 632 says, perhaps a bit tersely, 
that when the 3.11 branch is established for 3.11.0b1 and master/main becomes 
the 3.12.0a development branch, disutils/* be no longer be installed as part of 
the stdlib (ie, in /Lib).  At that point, 'import disutils' will cease working 
in installed CPython, outside of a cpython repository.  Although this could be 
worked around by catching the import error and skipping disutils-dependent 
tests, the dependency should better be removed, if possible, before 3.12.0a.

The PEP gives no timetable for doing so, and anticipates separate PRs like this.

It further says that when "the CPython build process no longer depends on 
distutils being in the standard library, the entire Lib/distutils directory and 
Lib/test/test_distutils.py file will be removed from the repository."  Leaving 
it deprecated but present was rejected.

Part of the extensive discussion at 
https://discuss.python.org/t/pep-632-deprecate-distutils-module/5134/128 was 
about possibly putting parts of disutiles under /Tools and replacing 'import 
disutils' with a reference to /Tools/distutiles/whatever.  If this 
is done for tests, the access and use has to be conditional.  Our Windows 
installer only installs 4 or 21 Tools subdirectories thought appropriate for 
uses and others may include less, and maybe omit Tools altogether.

Karthikeyan posted the opening of this and another issue 5 days ago on #41281, 
with no comment so far.

--
nosy: +steve.dower, terry.reedy

___
Python tracker 

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



[issue27820] Possible bug in smtplib when initial_response_ok=False

2021-03-12 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset 32717b982d3347e30ae53eb434e2a32e0d03d51e by Miss Islington (bot) 
in branch '3.9':
bpo-27820: Fix AUTH LOGIN logic in smtplib.SMTP (GH-24118) (#24832)
https://github.com/python/cpython/commit/32717b982d3347e30ae53eb434e2a32e0d03d51e


--

___
Python tracker 

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



[issue27886] Docs: the difference between Path.rename() and Path.replace() is not obvious

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

The pathlib documentation of Path.rename() says "[o]n Unix, if target exists 
and is a file, it will be replaced silently if the user has permission". This 
leaves the behavior on Windows in question. The reader has to scroll down to 
the correspondence table to link to the documentation of os.rename() and 
presume that Path.rename() also raises FileExistsError for this case. The 
Path.rename() docs should just state upfront that "[o]n Windows, if target 
exists, FileExistsError will be raised".

--
components: +Library (Lib)
title: Docs: the difference between rename and replace is not obvious -> Docs: 
the difference between Path.rename() and Path.replace() is not obvious
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue27886] Docs: the difference between rename and replace is not obvious

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg273845

___
Python tracker 

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



[issue43438] [doc] sys.addaudithook() documentation should be more explicit on its limitations

2021-03-12 Thread Steve Dower


Steve Dower  added the comment:

If someone offers a patch for replacing the list of per-interpreter hooks with 
something not easily discoverable via gc, I'm sure we'd take it. It's all 
internal, so just hiding it from the list of bases should be fine (there should 
never be more than one reference), but turning it into a new form of 
dynamically expanding array/list would also work, providing whoever reviews it 
doesn't think it's adding too much complexity/instability.

But file that as a separate issue, please. It's somewhat debatable, while 
fixing the docs _needs_ to happen. (And I will get to it eventually if nobody 
else does, but I'm just as happy to review someone else's contribution. And 
MUCH happier to review a contribution than to argue about it on the tracker :) )

--

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-12 Thread Steve Dower


Steve Dower  added the comment:

Passing a tuple as "O" just means it gets passed as-is, without wrapping it 
again. And yeah, I thought that was right here, but it's not. I didn't realise 
it's a varargs argument. So yeah, it should be wrapped again so that only a 
single argument is being passed to the hooks.

Alternatively, raising one event for each object would also be valid. These 
functions behave identically for "f(a, b)" and "f(a) + f(b)", so raising the 
event for each object before traversing it would simplify hooks (but have more 
of a performance impact... which I suspect is totally irrelevant here anyway, 
so I'd be +1.1 on this approach vs. +1 on passing the args as a single 
argument).

If new arguments are added later, we need to add new events. Defining event 
schemas as "arbitrary arguments that may change is the future" is totally 
against the intended design.

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

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-12 Thread Adrian Freund


Adrian Freund  added the comment:

Thanks for the response. Looks like I overlooked the imports, global, nonlocal, 
... because I only searched for usages of identifier, but they use lists of 
identifiers.

In that case I agree that it isn't inconsistent.

--

___
Python tracker 

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



[issue35883] Change invalid unicode characters to replacement characters in argv

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Unicode
nosy: +ezio.melotti, vstinner
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue27820] Possible bug in smtplib when initial_response_ok=False

2021-03-12 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
pull_requests: +23599
pull_request: https://github.com/python/cpython/pull/24833

___
Python tracker 

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



[issue27820] Possible bug in smtplib when initial_response_ok=False

2021-03-12 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +23598
pull_request: https://github.com/python/cpython/pull/24832

___
Python tracker 

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



[issue27820] Possible bug in smtplib when initial_response_ok=False

2021-03-12 Thread Senthil Kumaran


Senthil Kumaran  added the comment:


New changeset 7591d9455eb37525c832da3d65e1a7b3e6dbf613 by Pandu E POLUAN in 
branch 'master':
bpo-27820: Fix AUTH LOGIN logic in smtplib.SMTP (GH-24118)
https://github.com/python/cpython/commit/7591d9455eb37525c832da3d65e1a7b3e6dbf613


--

___
Python tracker 

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



[issue37612] os.link(..., follow_symlinks=True) broken on Linux

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Extension Modules -Library (Lib)
versions: +Python 3.10 -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue43422] Revert _decimal C API changes

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

skrah is still a bpo user with an CLA-signed account linked to his github 
account.  So he can post here and, I believe, open a PR as a contributor.  But 
if, under the current circumstances, he feels more comfortable using Antoine as 
a go between, then I thank Antoine for doing so.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue27827] pathlib is_reserved fails for some reserved paths on Windows

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
stage: needs patch -> 
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue15244] Support for opening files with FILE_SHARE_DELETE on Windows

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

Deleting a file in Windows 10 has been updated to try a POSIX-style delete. For 
a POSIX delete, the filesystem unlinks the file even it's open, whereas a 
classic delete only unlinks a 'deleted' file when it's closed. The filesystem 
has to support it. NTFS does, which is the most important because the system 
drive is NTFS. This makes supporting FILE_SHARE_DELETE a more attractive 
option. 

That said, there are sill significant limits. Memory-mapped files can't be 
deleted (renamed, yes, but not removed). Also, most programs don't share delete 
access on their opens, which means they can't open a file that's currently open 
with delete access (e.g. NamedTemporaryFile), and their open files can't be 
deleted.

--
components: +IO, Windows -Library (Lib)
nosy: +paul.moore
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5

___
Python tracker 

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



[issue43420] Optimize rational arithmetics

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

A possible resolution to this issue might be augmenting 
https://docs.python.org/3/library/fractions.html#module-fractions
with a short paragraph or section on alternative implementations noting that 
there is a tradeoff between speed and complexity (and assured correctness).  If 
sympy has faster rationals, list that, and any other python-accessible 
alternative we have confidence in.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue43418] FTPLib error when server returns byte message instead of string

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

An exception exit is not a 'crash' for this tracker.  The latter is an 
indefinite hang or a no-exception stackoverflow or the Windows equivalent error 
box (or worse).  The linked issue appears to show an exception exit.

--
title: FTPLib module crashes when server returns byte message instead of string 
-> FTPLib error when server returns byte message instead of string
type: crash -> behavior

___
Python tracker 

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



[issue43418] FTPLib module crashes when server returns byte message instead of string

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

3.7 only gets security fixes.  Please verify that this is an issue with 3.10, 
or at least 3.9, and give a reproducible test case.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue43412] object.h -Wcast-qual warning

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Victor, the apparent 3.10 regression is from your commit.

--
nosy: +terry.reedy, vstinner

___
Python tracker 

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



[issue43482] PyAddPendingCall Function Never Called in 3.8, works in 3.6

2021-03-12 Thread Chris Morton


New submission from Chris Morton :

Building code on Mac OSX or Linux Ubuntu 16.04

#include 
#include 
#include 
#include 

// MacOSX build:
// g++ stop.cpp -I /include/pythonX.X -L /lib 
-lpythonX.X -o stop
// Linuxe requires addtional linkage:
// -lpthread

void RunPythonScript()
{
PyRun_SimpleString("# import sys \n"
   "import time \n"
   "# sys.setcheckinterval(-1) \n"
   "while True: \n"
   "print('Running!') \n"
   "time.sleep(1) \n"
   );

std::cout << "Terminating Python Interpreter." << std::endl;
}

int Stop(void *)
{
std::cout << "We threw an exception." <", line 6, in 
RuntimeError: Stop Python Execution.
Terminating Python Interpreter.
Exiting Main Function.

The Stop function is never called with the same code linked against Python 3.8.

--
components: C API
messages: 388559
nosy: chrisgmorton
priority: normal
severity: normal
status: open
title: PyAddPendingCall Function Never Called in 3.8, works in 3.6
versions: Python 3.8

___
Python tracker 

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



[issue43411] wm_manage fails with ttk.Frame

2021-03-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

You are confusing the widget path component, an arbitrary string of chars other 
than the separator '.', with the English word 'frame', which is also a tk 
command.  In tk docs, 'a *frame*' is a widget (tk window) created with the 
'frame' command.

By default, tk gives each widget(window) a unique but meaningless string of 
digits as its path component.  A user can override this by giving an explicit 
name option on creation.  

A few years ago, tkinter started always overriding the tk default with a  
readable name.  Serhiy and I agreed on using a '!' prefix since it was unlikely 
though not impossible to be used by tkinter users.  We must have agreed on not 
specifically flagging ttk widgets in the path component, as opposed to the 
widget name (see below).  A numerical suffix is added to duplicates.  The 
system is not perfect, but overall we prefer it to the tk digit sequences, in 
spite of the following possible confusion.

>>> c = ttk.Combobox(r, name='!frame')
>>> c

>>> c.widgetName
'ttk::combobox'
>>> c.master.wm_manage(c)
...
_tkinter.TclError: window ".!frame" is not manageable: must be a frame, 
labelframe or toplevel

For debugging in 'python -i' or IDLE 'run module' mode, one can followup by 
checking the passed-in widget's widgetName if it is not otherwise obvious.

If you want tk or its tk wm_manage doc at 
https://www.tcl.tk/man/tcl8.6/TkCmd/wm.htm#M53 changed, you have to ask the 
tcl.tk people.  Extremely unlikely I suspect.  I presume that there are 
technical reasons why a ttk Frame is not a drop-in replacement for a tk Frame 
in this context.  And since a *ttk::frame* is clearly different from a *frame*, 
the doc is clear enough.  For all other commands, the window can only be a 
*toplevel*, so the exception for wm manage is an extension to frame and 
labelframe, rather than a restriction.

Our 3-paragraph doc for the corresponding Wm class does not discuss the 
individual methods but implicitly defers to the tkinter.__init__ code and the 
tk doc.

Our ttk doc does not discuss the ttk widgets that are essentially copies of tk 
widgets except the mostly documented differences.  So there is not  a good 
place to say anything and I am dubious that we should.

So I think we should close as 'not a bug' unless Serhiy disagrees.

--
nosy: +serhiy.storchaka, terry.reedy

___
Python tracker 

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



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-12 Thread Chris Morton


New submission from Chris Morton :

Compiling (Window 10, MSVS 16):

#include 

int main(int argc, char* argv[])
{
const char* code = "c=[1,2,3,4]\nd={'list': [c[i] for i in 
range(len(c))]}\nprint(d)\n";

Py_Initialize();

PyObject* pycode = Py_CompileString(code, "", Py_file_input );   
PyObject* main_module = PyImport_AddModule("__main__");
PyObject* global_dict = PyModule_GetDict(main_module);
PyObject* local_dict = PyDict_New();

PyEval_EvalCode(pycode, global_dict, local_dict);  // (PyCodeObject*) 
pycode in Python 2.7

Py_Finalize();

return 0;

and executing yields:

Traceback (most recent call last):
  File "", line 2, in 
  File "", line 2, in 
NameError: name 'c' is not defined

While not particularly clever python code, it is not clear why the reference c 
is not in scope having previously been defined. Replacing the clumsy list 
comprehension using range() with c[:] or [ci for ci in c] produces the expected 
result:

{'list': [1, 2, 3, 4]}

This issue is not observed with Python 2.7 (.18).

--
components: C API
messages: 388557
nosy: chrisgmorton
priority: normal
severity: normal
status: open
title: PyEval_EvalCode() namespace issue not observed in Python 2.7.
versions: Python 3.8

___
Python tracker 

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



[issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector

2021-03-12 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue34780] [Windows] Hang on startup if stdin refers to a pipe with an outstanding concurrent operation on Windows

2021-03-12 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

2021-03-12 Thread Florian Bruhin


Florian Bruhin  added the comment:

I suppose returning the string unchanged would work as well. However, "Errors 
should never pass silently." :)

Perhaps that with a ignore_nameerror=True or switch or so would work?

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-12 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> This seams really inconsistent with the rest of the ast, where identifiers 
> are always wrapped in a ast.Name object. The only other exception to this is 
> ast.Attribute.

import ... as 
from ... import ... as 
try:
   ...
except ... as :
   ...

global 
nonlocal 
x(=...)

All s above are represented as strings. If  is 
guaranteed to be a single name, then it makes sense to just use an identifier 
instead of wrapping it with Name(). The reason that other stuff like "with ... 
as " uses  instead of  is that you can use extended 
assignment targets (such as unpacking a tuple) over there. 

This rule applies to all other stuff, except for NamedExprs. Which I believe it 
is because the restriction might lift in the future, but now they are limited 
to only keep Name()s. 

I don't personally know why Brandt choosed to use identifier, though I'm a +1 
on the current approach.

--

___
Python tracker 

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



[issue29657] os.symlink: FileExistsError shows wrong message

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Extension Modules, Interpreter Core -Library (Lib)
stage: patch review -> 
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-03-12 Thread Adrian Freund


Adrian Freund  added the comment:

For the last few days I've been working with pattern matching and it's ast for 
a bit, while trying to add support for it to mypy.

During this I noticed an inconsistency in the ast:

ast.MatchAs has an attribute name which is of type identifier (in C) and type 
str (in python).

This seams really inconsistent with the rest of the ast, where identifiers are 
always wrapped in a ast.Name object. The only other exception to this is 
ast.Attribute.

Judging from Grammar/python.gram this seems deliberate:

as_pattern[expr_ty]:
| pattern=or_pattern 'as' target=capture_pattern {
_Py_MatchAs(pattern, target->v.Name.id, EXTRA) }

Could someone shed some light on why MatchAs directly references an identifier 
instead of an ast.Name?

--
nosy: +freundTech

___
Python tracker 

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



[issue15453] ctype with packed bitfields does not match native compiler

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Ctypes Packing Bitfields Incorrectly - Linux

___
Python tracker 

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



[issue22781] ctypes: Differing results between Python and C.

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
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



[issue43334] venv does not install libpython

2021-03-12 Thread Anup Parikh


Anup Parikh  added the comment:

Also, at least on windows, the C-API header files are also missing from the venv

--

___
Python tracker 

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



[issue43334] venv does not install libpython

2021-03-12 Thread Anup Parikh


Anup Parikh  added the comment:

A typical python installation includes libpython libraries that C extensions 
can link to. Creating virtual environments with venv normally creates a replica 
of a python installation directory, including all the built in python modules. 
However, it doesn't seem to copy over the libpython libraries, so C extensions 
built with a venv activated can't seem to find the libpython (.so, .a, .dll) 
file to link against.

For example, compare the installation directory of python with the venv 
directory. The libpython .so/.a/.dll files are missing in the venv

--

___
Python tracker 

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



[issue29844] Windows Python installers not installing DLL to System32/SysWOW64

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

"Tools/msi/README.txt" still references "%SystemRoot%\System32" and 
"%SystemRoot%\SysWOW64" as the location of "python3[x].dll" for all-users 
installs. The containing paragraph can be removed. Move the lines for 
".\python3x.dll" and ".\python3.dll" unconditionally into the installation 
directory listing. Maybe also add ".\vcruntime140[_1].dll" to the listing.

--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue11429] ctypes is highly eclectic in its raw-memory support

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-12 Thread Saiyang Gou


Saiyang Gou  added the comment:

In addition to the consistency with existing audit hook signatures, there may 
also be another benefit of wrapping it with a tuple of length 1. If 
gc.get_referrers or gc.get_referents happens to gain a new keyword-only 
argument in the future, we may need to add the new argument to the hook args. 
Extending the `(objs,)` tuple to `(objs, new_kwarg)` is a bit more elegant than 
appending the `new_kwarg` to the end of the `objs` tuple itself (considering a 
hook function which tries to be compatible with both the old and the new 
signature).

--

___
Python tracker 

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



[issue34780] [Windows] Hang on startup if stdin refers to a pipe with an outstanding concurrent operation on Windows

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

If non-disk files are made non-seekable in Windows, this will also resolve 
bpo-42602.

--

___
Python tracker 

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



[issue40540] inconstent stdin buffering/seeking behaviour

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> seekable() returns True on pipe objects in Windows

___
Python tracker 

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



[issue34780] [Windows] Hang on startup if stdin refers to a pipe with an outstanding concurrent operation on Windows

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

Console input handles pose the same risk of hanging indefinitely when io.FileIO 
is used in legacy standard I/O mode (i.e. PYTHONLEGACYWINDOWSSTDIO).

Seeking could simply be disallowed on all files that aren't FILE_TYPE_DISK. For 
example, change portable_lseek() in Modules/_io/fileio.c to check the file type:

if (GetFileType((HANDLE)_get_osfhandle(fd)) != FILE_TYPE_DISK) {
errno = ESPIPE;
res = -1;
} else {
res = _lseeki64(fd, pos, whence);
}

--
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue43458] Tutorial should mention about variable scope in try/except/finally

2021-03-12 Thread Éric Araujo

Éric Araujo  added the comment:

The only blocks that create scopes are modules, class and functions.
if, try, with, for, while, etc are blocks but not new scopes.

For the tutorial it could be nice to have an explicit mention and example of 
this.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue43198] One operation on sets < 1/100th as efficient in 3.9 than before

2021-03-12 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: Operations on sets more than hundred times less efficient with python3.9 
than with previous versions -> One operation on sets < 1/100th as efficient in 
3.9 than before

___
Python tracker 

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



[issue40601] [C API] Hide static types from the limited C API

2021-03-12 Thread STINNER Victor


STINNER Victor  added the comment:

I plan to write such PEP soon.

--

___
Python tracker 

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



[issue40601] [C API] Hide static types from the limited C API

2021-03-12 Thread STINNER Victor


STINNER Victor  added the comment:

The Steering Council asked for a PEP to explain why static types should be 
converted to heap types.

--

___
Python tracker 

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



[issue26882] The Python process stops responding immediately after starting

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

Hanging on a synchronous console file during startup shouldn't be an issue in 
3.6+, since io._WindowsConsoleIO doesn't support seeking, but it could still be 
an issue with legacy mode, which uses io.FileIO. I'm marking this as a 
duplicate of bpo-34780, which has more information. It's basically the same 
problem that seeking should only be supported for files opened for physical 
disks, volumes, and regular data files in mounted filesystems -- for which its 
meaningful, useful, and not vulnerable to hanging indefinitely if the file is 
blocked on a synchronous I/O request (e.g. a read request from a pipe or 
console input, which might never complete).

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> [Windows] Hang on startup if stdin refers to a pipe with an 
outstanding concurrent operation on Windows

___
Python tracker 

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



[issue25741] Usual Installation Directory

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

I'm closing this issue as out of date. The tutorial now refers to the py 
command and also the python3.9 command from the app distribution. The patch's 
addition of "followed by Enter" after "Control-Z" is still needed, but it's not 
related to this issue.

--
resolution:  -> out of date
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



[issue20408] memoryview() constructor documentation error

2021-03-12 Thread Larry Hastings


Change by Larry Hastings :


--
nosy:  -larry

___
Python tracker 

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



[issue20408] memoryview() constructor documentation error

2021-03-12 Thread Mariusz Felisiak


Change by Mariusz Felisiak :


--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue24052] sys.exit(code) returns "success" to the OS for some nonzero values of code

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5

___
Python tracker 

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



[issue21518] Expose RegUnLoadKey in winreg

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

I added an updated implementation of windows_helper.py to the dependency 
bpo-22080.

--
components: +Windows
nosy: +paul.moore
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5

___
Python tracker 

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



[issue31427] Add an answer to the Windows FAQ about installing the Universal C Runtime

2021-03-12 Thread Eryk Sun


Change by Eryk Sun :


--
title: Proposed addition to Windows FAQ -> Add an answer to the Windows FAQ 
about installing the Universal C Runtime
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue40601] [C API] Hide static types from the limited C API

2021-03-12 Thread junyixie

junyixie  added the comment:

It seems that there is no continued progress for move static type in heap.This 
will make it impossible to continue to achieve sub interpreters parallel. Are 
there any plans to try other solutions to the problem?

In my project, i try to slove this problem, It can work, we verify on millions 
of devices.

1. In typeobject.c add lock to ensure that some functions that modification 
type are thread-safe
2. and make the PyCFunction and descri object of the Type will never be 
released. (Frequently used when load method/attributed, locking affects 
performance)

Can this change be submitted to cpython?

--
nosy: +JunyiXie

___
Python tracker 

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



[issue43480] Add .path method/property to tempfile.* for a pathlib.Path

2021-03-12 Thread Patrick Reader


New submission from Patrick Reader :

It would be nice to have a `.path` method or property on 
`tempfile.NamedTemporaryFile`, `tempfile.TemporaryDirectory` which produces a 
`pathlib.Path` of their `.name` attribute, so one can use the modern interface 
directly.

I think a method would be more appropriate than a property because you're 
explicitly allocating a new object (unless you use `@functools.cached_property` 
or similar to have a shared object between successive calls)

I can do a PR.

--
components: Library (Lib)
messages: 388540
nosy: pxeger
priority: normal
severity: normal
status: open
title: Add .path method/property to tempfile.* for a pathlib.Path
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue43439] [security] Add audit events on GC functions giving access to all Python objects

2021-03-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Steve, do you think that makes sense? If so, I will create a batch of PRs to 
correct it.

--

___
Python tracker 

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



[issue43479] Remove a duplicate comment and assignment in http.client

2021-03-12 Thread Géry

New submission from Géry :

Remove a duplicate comment and assignment following the usage of a name already 
assigned in the http.client standard library.

--
components: Library (Lib)
messages: 388538
nosy: maggyero
priority: normal
pull_requests: 23597
severity: normal
status: open
title: Remove a duplicate comment and assignment in http.client
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



[issue43471] Fails to import bz2 on Ubuntu

2021-03-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

You are likely did not have headers for bz2 library installed. Read 
thoughtfully the output of ./configure and make.

See also https://devguide.python.org/setup/#install-dependencies .

--
nosy: +serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue43353] Document that logging.getLevelName() can return a numeric value.

2021-03-12 Thread miss-islington


miss-islington  added the comment:


New changeset 4d7f11e05731f67fd2c07ec2972c6cb9861d52be by Mariusz Felisiak in 
branch '3.9':
[3.9] bpo-43353: Document that logging.getLevelName() accepts string 
representation of logging level. (GH-24693) (GH-24826)
https://github.com/python/cpython/commit/4d7f11e05731f67fd2c07ec2972c6cb9861d52be


--

___
Python tracker 

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