[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-05-19 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

> Okay, well, I'm trying to understand minithesis.py, but I am despairing. The 
> shrinking code (really everything in class TestingState) is too much to grok. 
> ... I suppose I have to read the paper at 
> https://drmaciver.github.io/papers/reduction-via-generation-preview.pdf ... I 
> am still unclear on some basics too, but presumably it's all related.

Shrinking is probably not important to understand, since it's *not* 
particularly related to anything but implementation details.  The abstract of 
that paper explains why the design is important - integrated shrinking means we 
can report minimal (easier-to-understand) failing examples with zero user 
effort, and guarantee that all shrunk examples could have been generated.

TestingState is, roughly, the `@given()` decorator internals: responsible for 
deciding how many times to run the wrapped test function, and how.  Note the 
three phases (generate, target, shrink) - the distribution of examples can 
depend on the behaviour of the test function on earlier inputs.  This is _more_ 
complex in Hypothesis and thus challenging to document.

The important concept is that input examples are generated by a Possibility (ie 
Strategy), which internally makes a sequence of choices; and that sequence is 
sourced from a maybe-empty known prefix (e.g. replaying failures, mutating 
previous inputs) with the suffix determined by a PRNG.


I feel like I'm explaining this badly, but there isn't a simple underlying 
thing to explain - Hypothesis works well because the user API is relatively 
simple, and then under the hood we have this many-layered stack of 
implementation details.  The synergies and coverage of otherwise-pathological 
cases this delivers is excellent, but "multiple years and PhDs worth of 
detailed synergistic work" is just intrinsically complicated.


> PS. What does "shortlex" mean?

Sort by length, and among equal-length strings sort in the normal 
(alphabetical) order.  For example: A < XY < ABC, etc.

--

___
Python tracker 

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



[issue30593] Document that sqlite3.Cursor.executescript disregards isolation_level

2021-05-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +24847
pull_request: https://github.com/python/cpython/pull/26230

___
Python tracker 

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



[issue30593] Document that sqlite3.Cursor.executescript disregards isolation_level

2021-05-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24848
pull_request: https://github.com/python/cpython/pull/26231

___
Python tracker 

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



[issue42627] urllib.request.getproxies() misparses Windows registry proxy settings

2021-05-19 Thread Chris Xiao


Chris Xiao  added the comment:

I found this problem too.
expecting for fixing

--
nosy: +chrisxiao

___
Python tracker 

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



[issue44099] [C API] Introduce a new slot in PyModuleDef to hold the classes

2021-05-19 Thread Shreyan Avigyan


Change by Shreyan Avigyan :


--
title: [c-api] Introduce a new slot in PyModuleDef to hold the classes -> [C 
API] Introduce a new slot in PyModuleDef to hold the classes

___
Python tracker 

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



[issue30593] Document that sqlite3.Cursor.executescript disregards isolation_level

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 76ed53ca7bf0d4a43099d9401af5fe9f75689885 by Miss Islington (bot) 
in branch '3.9':
bpo-30593: Doc'ed that executescript() disregards isolation level (GH-26220)
https://github.com/python/cpython/commit/76ed53ca7bf0d4a43099d9401af5fe9f75689885


--

___
Python tracker 

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



[issue30593] Document that sqlite3.Cursor.executescript disregards isolation_level

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 1f483c0c1b5a9fd1062bacc2aeba6bb0e9b7 by Miss Islington (bot) 
in branch '3.10':
bpo-30593: Doc'ed that executescript() disregards isolation level (GH-26220)
https://github.com/python/cpython/commit/1f483c0c1b5a9fd1062bacc2aeba6bb0e9b7


--

___
Python tracker 

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



[issue30593] Document that sqlite3.Cursor.executescript disregards isolation_level

2021-05-19 Thread Berker Peksag


Change by Berker Peksag :


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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +24849
pull_request: https://github.com/python/cpython/pull/26232

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24850
pull_request: https://github.com/python/cpython/pull/26233

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset db20afe6c43ad585577589131bf658ce7ebe6bd2 by Miss Islington (bot) 
in branch '3.9':
bpo-44106: Improve sqlite3 example database contents (GH-26027)
https://github.com/python/cpython/commit/db20afe6c43ad585577589131bf658ce7ebe6bd2


--

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 3185bc9d3f38ce9d814aecf8104f1d6953c2d8ff by Miss Islington (bot) 
in branch '3.10':
bpo-44106: Improve sqlite3 example database contents (GH-26027)
https://github.com/python/cpython/commit/3185bc9d3f38ce9d814aecf8104f1d6953c2d8ff


--

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24851
pull_request: https://github.com/python/cpython/pull/26234

___
Python tracker 

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



[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:

> Or is it ok to call gc.collect() in the test suite?

It is but in this case I'd say it's a bit weird that we need to call it. 
Unfortunately, I don't have much time to investigate it at the moment.

--

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24852
pull_request: https://github.com/python/cpython/pull/26235

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24853
pull_request: https://github.com/python/cpython/pull/26236

___
Python tracker 

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



[issue21465] sqlite3 Row can return duplicate keys when using adapters

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

AFAICS, this has nothing to do with adapters; you'll get duplicate keys just by 
executing 'select 1 as "token", 2 as "token"'. If you want the columns to have 
unique names, you should assign them unique names.

At most, there could be a sentence about this in the docs ("best practices"), 
but IMO this should be obvious. I would leave the docs as they are.

Suggesting to close this as not a bug.

--
assignee: ghaering -> 
nosy: +berker.peksag, erlendaasland -ghaering
status: open -> pending

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 5b5a10c8740aa5e9fd68a10d9cb23b0e7d61ce98 by Miss Islington (bot) 
in branch '3.9':
bpo-44106: Purge unused sqlite3 doc includes (GH-26234)
https://github.com/python/cpython/commit/5b5a10c8740aa5e9fd68a10d9cb23b0e7d61ce98


--

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset e57bef1b73abb8e89d927053bd7e4fdbf44687bf by Miss Islington (bot) 
in branch '3.10':
bpo-44106: Purge unused sqlite3 doc includes (GH-26234)
https://github.com/python/cpython/commit/e57bef1b73abb8e89d927053bd7e4fdbf44687bf


--

___
Python tracker 

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



[issue44106] [sqlite3] don't use politicians in examples/docs

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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



[issue44079] [sqlite3] remove superfluous statement weak ref list from connection object

2021-05-19 Thread Berker Peksag


Berker Peksag  added the comment:

https://github.com/ghaering/pysqlite/commit/33f99be6be5ad7d69767ff172441f1a860416e82
 states the following:

- Use a list of weak references of statements in the Connection class to 
keep
  track of all statements used with this connection. This is necessary to be
  able to reset all statements used in a connection.

My understanding is that their usages is a bit different: one is for 
performance reasons (and it can configurable by users) and the other is to keep 
track of statements inside a connection.

I'm not fully sure that the both use cases can be combined.

--
type: resource usage -> enhancement

___
Python tracker 

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



[issue35765] Document references object x but doesn't show it in the example

2021-05-19 Thread Irit Katriel


Change by Irit Katriel :


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



[issue35765] Document references object x but doesn't show it in the example

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 74eb94af2b0ca652d4b6b9b853601a8b8ac7dca1 by Miss Islington (bot) 
in branch '3.9':
bpo-35765: Clarify references to "object x" in the JSON tutorial (GH-22411) 
(GH-26219)
https://github.com/python/cpython/commit/74eb94af2b0ca652d4b6b9b853601a8b8ac7dca1


--

___
Python tracker 

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



[issue35765] Document references object x but doesn't show it in the example

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 5f2afff1ddbf11c8dfa9ddc98fb7a2f2d86eabde by Miss Islington (bot) 
in branch '3.10':
bpo-35765: Clarify references to "object x" in the JSON tutorial (GH-22411) 
(GH-26218)
https://github.com/python/cpython/commit/5f2afff1ddbf11c8dfa9ddc98fb7a2f2d86eabde


--
nosy: +iritkatriel

___
Python tracker 

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



[issue44174] Unclear meaning of _Private__names in enum docs.

2021-05-19 Thread Ken Jin


Ken Jin  added the comment:

I think linking to this part of the docs may help 
https://docs.python.org/3/reference/expressions.html#atom-identifiers

There's also already a label to reference to, so
the sentence could start with :ref:`Private names `.

--
keywords: +easy, newcomer friendly
nosy: +kj

___
Python tracker 

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



[issue44010] IDLE: highlight soft keywords

2021-05-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +24854
pull_request: https://github.com/python/cpython/pull/26237

___
Python tracker 

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



[issue8264] [doc] hasattr doesn't show private (double underscore) attributes exist

2021-05-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +24855
pull_request: https://github.com/python/cpython/pull/26238

___
Python tracker 

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



[issue44010] IDLE: highlight soft keywords

2021-05-19 Thread miss-islington


miss-islington  added the comment:


New changeset 3357604db966693b752cbd9ffc3ad0f40b970d31 by Miss Islington (bot) 
in branch '3.10':
bpo-44010: IDLE: colorize pattern-matching soft keywords (GH-25851)
https://github.com/python/cpython/commit/3357604db966693b752cbd9ffc3ad0f40b970d31


--

___
Python tracker 

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



[issue25190] Define StringIO seek offset as code point offset

2021-05-19 Thread Eli_B


Change by Eli_B :


--
nosy: +Eli_B

___
Python tracker 

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



[issue44177] Unable to get the else while parsing through AST module

2021-05-19 Thread Bikram Singh Mehra


New submission from Bikram Singh Mehra :

Hi Team,

I was parsing python file using AST module but ran into a situation where the 
else statement is not found in the parsed data.

-
Module used is: ast
-

In the parsed data I can see "if" followed by "elif" but the "else" part I am 
not able to see.

Sample code used:
-
sample_data = """
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
"""
-

tree = ast.parse(sample_data )

The above code provide me below data in ast.dump(tree)

Module(body=[If(test=Compare(left=Name(id='num', ctx=Load()), ops=[Gt()], 
comparators=[Constant(value=0, kind=None)]), 
body=[Expr(value=Call(func=Name(id='print', ctx=Load()), 
args=[Constant(value='Positive number', kind=None)], keywords=[]))], 
orelse=[If(test=Compare(left=Name(id='num', ctx=Load()), ops=[Eq()], 
comparators=[Constant(value=0, kind=None)]), 
body=[Expr(value=Call(func=Name(id='print', ctx=Load()), 
args=[Constant(value='Zero', kind=None)], keywords=[]))], 
orelse=[Expr(value=Call(func=Name(id='print', ctx=Load()), 
args=[Constant(value='Negative number', kind=None)], keywords=[]))])])], 
type_ignores=[])

While I was traversing through this tree I can't see else in the structure 
because it is subpart of orelse i.e. inside elif part.


Doc referred is : https://docs.python.org/3/library/ast.html
 

Thanks and Best Regards,
Bikram

--
components: Parser
messages: 393941
nosy: bikrammehra97, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Unable to get the else while parsing through AST module
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue44079] [sqlite3] remove superfluous statement weak ref list from connection object

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Yes, that seems to be the intention. But, I don't think there is a need to 
maintain the second list:

1. Resetting statements was historically needed both for commit and rollback; 
pending statements would block such operations. That's no longer the case for 
recent SQLite versions (commits fixed in SQLite 3.6.5, rollbacks in SQLite 
3.7.11). The sqlite3 module no longer reset commit statements 
(6ed442c48dd7f8d3097e688a36bc027df3271621), and there should be no need to 
reset rollbacks either (see bpo-44092).
2. A statement with ref count zero will be garbage collected. Thus, of a 
statement is dropped from the LRU cache, it will be sqlite3_finalize'd. No 
statement, no problem. It's the same effect as if 
_pysqlite_drop_unused_statement_references() used the same limit as the LRU 
cache.

If we want to explicit reset statements (for some reason), we'd be better off 
to use sqlite3_stmt_next(). It's faster, and it covers _all_ statements for a 
given connection.

--

___
Python tracker 

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



[issue44120] logging.config.fileConfig/dictConfig can not import class

2021-05-19 Thread Vinay Sajip


Vinay Sajip  added the comment:

The problem is caused by the "import logging" in bar/__init__.py, which causes 
bar.logging to not be found because it clashes with the stdlib logging package. 
If you change the statement to

from . import logging

then the error does not occur. So I don't think it is a bug, because it is 
caused by using a module name which is part of the stdlib in an ambiguous way.

--
nosy: +vinay.sajip
type: crash -> behavior

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


Removed file: https://bugs.python.org/file50029/patch.diff

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

The effect of PR 26026 is that InterfaceError is no longer raised for fetch 
across rollback; instead it is up to SQLite how to handle this:

- for some cases, SQLITE_ABORT or SQLITE_ABORT_ROLLBACK may be returned, which 
will result in an OperationalError (accompanied by a nice error message 
provided by SQLite)
- for other cases, no error is returned; the operation is allowed and succeeds 
as expected
- for yet other cases, no error is returned, and the operation was rolled back

A NEWS entry should mention the change in behaviour, but I can't see how it 
would break existing projects; the current code disallows fetch across rollback 
(InterfaceError), so any problematic code would have been found, handled and 
fixed during debugging.

--

___
Python tracker 

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I've crafted a number of rollback tests, but it occurred to me that they are 
simply just testing SQLite behaviour; not sqlite3 behaviour. I had to adjust 
the tests according to which version of SQLite was used (for example 3.8.7.2 
introduced new behaviour). Such tests are bound to break as SQLite evolves. I'm 
not sure we want such tests in our test suite; it can make the CI fail for 
completely unrelated PRs. Suggesting to leave detailed rollback testing to 
SQLite and just keep a couple of basic tests in our suite.

--

___
Python tracker 

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



[issue20587] sqlite3 converter not being called

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I'm unable to reproduce this on 3.8 though 3.11a0. It's unclear to me if this 
even was an issue. (I have no ancient Python versions to test with.)

Closing as out-of-date in a day or two, unless someone disagrees.

--
nosy: +erlendaasland
status: open -> pending

___
Python tracker 

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



[issue9924] sqlite3 SELECT does not BEGIN a transaction, but should according to spec

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue44177] Unable to get the else while parsing through AST module

2021-05-19 Thread Eric V. Smith


Eric V. Smith  added the comment:

Formatting the result, I get:
Module(body=[If(test=Compare(left=Name(id='num', ctx=Load()),
 ops=[Gt()],
 comparators=[Constant(value=0, kind=None)]),
body=[Expr(value=Call(func=Name(id='print', ctx=Load()),
  args=[Constant(value='Positive number',
 kind=None)],
  keywords=[]))],
orelse=[If(test=Compare(left=Name(id='num', ctx=Load()),
ops=[Eq()],
comparators=[Constant(value=0, 
kind=None)]),
   body=[Expr(value=Call(func=Name(id='print', 
ctx=Load()),
 args=[Constant(value='Zero', 
kind=None)],
 keywords=[]))],
   orelse=[Expr(value=Call(func=Name(id='print', 
ctx=Load()),
   
args=[Constant(value='Negative number', kind=None)],
   keywords=[]))])])],
   type_ignores=[])

You'll have to extract the "else" part by walking the tree yourself.

> I was parsing python file using AST module but ran into a situation where the 
> else statement is not found in the parsed data.

It is in the parsed data, though. Just not directly in the "If" node.

--
nosy: +eric.smith

___
Python tracker 

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



[issue24929] _strptime.TimeRE should not enforce range in regex

2021-05-19 Thread Catherine Devlin


Catherine Devlin  added the comment:

Can we close the ticket?  It doesn't sound like we're going to go with anything 
like this approach.

If there's a good place to record the general ambitions (better strptime tests, 
more clear strptime errors), that would be good, but I don't think we use 
tickets for that.

--

___
Python tracker 

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



[issue44177] Unable to get the else while parsing through AST module

2021-05-19 Thread Bikram Singh Mehra


Bikram Singh Mehra  added the comment:

Hi Eric,

Thanks for the quick response here,

I have gone through your suggestion but following that I am able to print the 
else node data i.e. "print("Negative number")" but unable to get the lineno of 
that else child node.

Could you please confirm if there is a way in AST where I can get the lineno of 
the else child node.

Thanks and Best Regards,
Bikram

--

___
Python tracker 

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



[issue44177] Unable to get the else while parsing through AST module

2021-05-19 Thread Eric V. Smith


Eric V. Smith  added the comment:

It's in the AST. 

>>> tree.body[0].orelse[0].orelse[0].lineno
7

To see it with dump, use: ast.dump(tree, include_attributes=True)

Which, after some reformatting, gives:

Module(body=[If(test=Compare(left=Name(id='num', ctx=Load(), lineno=2, 
col_offset=3, end_lineno=2, end_col_offset=6),
 ops=[Gt()], comparators=[Constant(value=0, 
kind=None, lineno=2, col_offset=9, end_lineno=2, end_col_offset=10)],
 lineno=2, col_offset=3, end_lineno=2, 
end_col_offset=10),
body=[Expr(value=Call(func=Name(id='print', ctx=Load(), 
lineno=3, col_offset=4, end_lineno=3, end_col_offset=9),
  args=[Constant(value='Positive number', 
kind=None, lineno=3, col_offset=10, end_lineno=3, end_col_offset=27)],
  keywords=[], lineno=3, col_offset=4, 
end_lineno=3, end_col_offset=28),
   lineno=3, col_offset=4, end_lineno=3, 
end_col_offset=28)],
orelse=[If(test=Compare(left=Name(id='num', ctx=Load(), 
lineno=4, col_offset=5, end_lineno=4, end_col_offset=8),
ops=[Eq()],
comparators=[Constant(value=0, 
kind=None, lineno=4, col_offset=12, end_lineno=4, end_col_offset=13)], 
lineno=4, col_offset=5, end_lineno=4, end_col_offset=13),
   body=[Expr(value=Call(func=Name(id='print', 
ctx=Load(), lineno=5, col_offset=4, end_lineno=5, end_col_offset=9),
 args=[Constant(value='Zero', 
kind=None, lineno=5, col_offset=10, end_lineno=5, end_col_offset=16)],
 keywords=[], lineno=5, 
col_offset=4, end_lineno=5, end_col_offset=17),
  lineno=5, col_offset=4, end_lineno=5, 
end_col_offset=17)],
   orelse=[Expr(value=Call(func=Name(id='print', 
ctx=Load(), lineno=7, col_offset=4, end_lineno=7, end_col_offset=9),
   
args=[Constant(value='Negative number', kind=None, lineno=7, col_offset=10, 
end_lineno=7, end_col_offset=27)],
   keywords=[], lineno=7, 
col_offset=4, end_lineno=7, end_col_offset=28),
lineno=7, col_offset=4, end_lineno=7, 
end_col_offset=28)], lineno=4, col_offset=0, end_lineno=7, end_col_offset=28)],
lineno=2, col_offset=0, end_lineno=7, end_col_offset=28)], 
type_ignores=[])"

I don't think there's any enhancement to be made here, so I'm going to close 
this issue.

--
resolution:  -> works for me
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



[issue44178] Add an interpreter-level critical section construct

2021-05-19 Thread Xavier Morel


New submission from Xavier Morel :

Python code uses a fair amount of globals, and sometimes there's no good choice 
but to do dodgy things and temporarily update global state for one reason or 
another e.g. redirect a standard fd or stream (cf redirect_stdout), 
monkey-patch a builtin to intercept some behaviour, etc...

One issue with this is, if the program is multithreaded there is no real way to 
prevent the interpreter from suspending the current thread *while doing the 
dodgy thing*. The only interpreter-level global lock would be the GIL, and 
while native extension can just not release the GIL this is not an option for 
Python code (as far as I know).

`sys` does provide getswitchinterval()/setswitchinterval() (and under the old 
GIL had getcheckinterval()/setcheckinterval()), but the semantics of these 
functions is a bit obscure (e.g. does `sys.setcheckinterval` update the 
*current* time slice os is the current thread doomed? can it fail? what happens 
if it does?) and they feel extremely uncomfortable.

As such, having a context manager which would explicitly but only prevent 
thread switching while it's held would be valuable. Assuming 
`setswitchinginterval` operates on the "current" timeslice, this would not 
provide any more misbehaving powers as any code can already call 
`sys.setswitchinterval(sys.maxsize)` (unless there are already mitigation 
systems in-place), and the contextmanager could just do that internally if that 
is the "correct" way to prevent thread switching under the current scheme.

The one thing which is not great is that this scheme might not really work 
under GILectomy, but then neither does switchinterval I think.

--
components: Interpreter Core
messages: 393951
nosy: xmorel
priority: normal
severity: normal
status: open
title: Add an interpreter-level critical section construct
type: enhancement
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



[issue44179] python3 终端 range函数显示错误

2021-05-19 Thread liaoliaoxiansheng

New submission from liaoliaoxiansheng <1041585...@qq.com>:

[root@ct7-2 bin]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@ct7-2 bin]# python2
Python 2.7.5 (default, Nov 16 2020, 22:23:17) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> range(5, 10)
[5, 6, 7, 8, 9]
>>> range(0, 10, 3)
[0, 3, 6, 9]
>>> range(-10, -100, -30)
[-10, -40, -70]
>>> 
[root@ct7-2 bin]# python3
Python 3.9.5 (default, May 19 2021, 19:38:48) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> range(5, 10)
range(5, 10)
>>> range(0, 10, 3)
range(0, 10, 3)
>>> range(-10, -100, -30)
range(-10, -100, -30)

--
assignee: docs@python
components: Documentation
messages: 393952
nosy: docs@python, happy789450
priority: normal
severity: normal
status: open
title: python3 终端 range函数显示错误
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



[issue44179] python3 终端 range函数显示错误

2021-05-19 Thread Christian Heimes


Christian Heimes  added the comment:

In Python 3 the range() builtin returns an iterator, not a list of items. You 
have to exhaust the iterator to get a list of iterator items.

>>> list(range(-10, -100, -30))
[-10, -40, -70]

--
nosy: +christian.heimes
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



[issue44131] [C API] Add tests on Py_FrozenMain()

2021-05-19 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +24858
pull_request: https://github.com/python/cpython/pull/26241

___
Python tracker 

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2021-05-19 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +24857
pull_request: https://github.com/python/cpython/pull/26241

___
Python tracker 

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



[issue44175] What do "cased" and "uncased" mean?

2021-05-19 Thread Isaac Ge


Isaac Ge  added the comment:

Why does "a".istitle() return "False" while it is not followed by any uncased 
character?

--

___
Python tracker 

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



[issue43795] Implement PEP 652 -- Maintaining the Stable ABI

2021-05-19 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +24856
pull_request: https://github.com/python/cpython/pull/26241

___
Python tracker 

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



[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Just to clarify, is the proposal to return a 
> regular tuple instead of named tuple?

No, it should still have named fields.  Either Line or LinearRegression would 
suffice.

--

___
Python tracker 

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



[issue44099] [C API] Introduce a new slot in PyModuleDef to hold the classes

2021-05-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

First off, note that you can use PyModule_AddType rather than 
PyModule_AddObject to avoid repeating the name.

Adding this *correctly* will be somewhat involved: slots take function 
pointers, not data pointers which are incompatible according to standard C. The 
changes will also need to keep backwards compatibility.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue44099] [C API] Introduce a new slot in PyModuleDef to hold the classes

2021-05-19 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Yes and it wouldn't be a problem. If struct member is 0 or NULL then use 
default behavior. If not then apply PyModule_AddType or PyModule_AddObject on 
all of those. Then after finishing set slot to NULL again since we don't want 
to add a type more than once. And yes after this also anyone can add more 
types. This will just introduce a handy way to add types.

--

___
Python tracker 

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



[issue29298] argparse fails with required subparsers, un-named dest, and empty argv

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:

crash means segfault, not unhandled exception.

--
nosy: +iritkatriel
type: crash -> behavior
versions: +Python 3.10, Python 3.11 -Python 2.7, Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 

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



[issue40811] Allow to create new Event Loops on Threads

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:

Should this be closed as rejected or is there further discussion?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue44174] Unclear meaning of _Private__names in enum docs.

2021-05-19 Thread Ethan Furman


Ethan Furman  added the comment:

Looks good.  Patches welcome.  :-)

--
nosy: +ethan.furman

___
Python tracker 

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



[issue40975] contextlib.AsyncExitStack enter_async_context and aclose should be labeled as coroutine methods

2021-05-19 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue42653] Expose ISO-TP Contants for Linux >= 5.10

2021-05-19 Thread menschel


Change by menschel :


--
keywords: +patch
nosy: +menschel
nosy_count: 1.0 -> 2.0
pull_requests: +24859
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26174

___
Python tracker 

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



[issue44168] Wrong syntax error hint when spurious colon present in function keyword comprehension assignment

2021-05-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +24860
pull_request: https://github.com/python/cpython/pull/26247

___
Python tracker 

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



[issue44168] Wrong syntax error hint when spurious colon present in function keyword comprehension assignment

2021-05-19 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +24861
pull_request: https://github.com/python/cpython/pull/26250

___
Python tracker 

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



[issue44168] Wrong syntax error hint when spurious colon present in function keyword comprehension assignment

2021-05-19 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue42722] Add --debug command line option to unittest to enable post-mortem debugging

2021-05-19 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This is a duplicate of https://bugs.python.org/issue18765, which already has 
some discussion going for a few years, so please follow up there.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44168] Wrong syntax error hint when spurious colon present in function keyword comprehension assignment

2021-05-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset d4a9264ab899b4f3088b5afad8956123924a5ab1 by Pablo Galindo in 
branch '3.9':
[3.9] bpo-44168: Fix error message in the parser for keyword arguments for 
invalid expressions (GH-26210) (GH-26250)
https://github.com/python/cpython/commit/d4a9264ab899b4f3088b5afad8956123924a5ab1


--

___
Python tracker 

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



[issue44168] Wrong syntax error hint when spurious colon present in function keyword comprehension assignment

2021-05-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset ec0699c044b4272a1face752fd39b8230f96c0da by Miss Islington (bot) 
in branch '3.10':
bpo-44168: Fix error message in the parser for keyword arguments for invalid 
expressions (GH-26210) (GH-26247)
https://github.com/python/cpython/commit/ec0699c044b4272a1face752fd39b8230f96c0da


--

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Andre Roberge


New submission from Andre Roberge :

When an equal sign is used instead of a colon in creating a dict literal, 
depending on the context, either the "bad token" is misidentified OR the 
would-be helpful error message is incorrect in this particular case.

1) Example of bad token.
Previously, the = sign was identified correctly:

>>> ages = {'Alice'=22, 'Bob'=23}
  File "", line 1
ages = {'Alice'=22, 'Bob'=23}
   ^
SyntaxError: invalid syntax

With Python 3.10.0b1, the comma is identified as the bad token:

>>> ages = {'Alice'=22, 'Bob'=23}
  File "", line 1
ages = {'Alice'=22, 'Bob'=23}
  ^
SyntaxError: invalid syntax


2) Example of incorrect error message

Previously, we got the traditional and unhelpful "invalid syntax" but with the 
bad token identified correctly:

>>> ages = {'Alice'=22}
  File "", line 1
ages = {'Alice'=22}
   ^
SyntaxError: invalid syntax

With Python 3.10.0b1, we get the following:

>>> ages = {'Alice'=22}
  File "", line 1
ages = {'Alice'=22}
^^^
SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?

I suspect that the ratio (== suggestion correct/ : suggestion correct) would be 
vanishingly small. ;-)

--
components: Parser
messages: 393964
nosy: aroberge, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict 
literal
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



[issue42722] Add --debug command line option to unittest to enable post-mortem debugging

2021-05-19 Thread Ned Deily


Change by Ned Deily :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

The bad token example needs a fix but the second is actually ok because we have 
another type we write within curly braces "{" and there the error is actually 
perfect. Like if we follow the error message, we use

ages = {'Alice'==22}

And we actually get a "set" with the first value as False. Sets behaves 
syntactically like list but have different behaviors of mathematical sets.

--
nosy: +shreyanavigyan

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I have an idea of what's causing the first one, but the second I am not sure we 
can detect easily we are in that case. Do you have a suggestion for what to 
place in the second case?

--

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

I'm don't the second is a problem at all. What the error message is suggesting 
is perfect since it doesn't know if we're trying to use a set or dict.

--

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Sorry for the typos.

--

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I don't know, it think is more likely that people are triying to use the "=" as 
a ":" and constructing a literal. Is not a bad error, but I think is not the 
best one

--

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Hmmm... Then is it possible to add an exception where the error message will 
result in,

SyntaxError: cannot assign to literal here. Maybe you meant ':', "==" or ":=" 
instead of '='?

only if we're dealing with curly braces?

--

___
Python tracker 

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



[issue44180] SyntaxError misidentified in 3.10.0b1 when = used instead of : in dict literal

2021-05-19 Thread Andre Roberge


Andre Roberge  added the comment:

In the second case, I understand very well that it could have been a set 
literal. In my (limited) experience, I have never seen a set literal containing 
a single element obtained from an == comparison.

Since dict can be built by using keyword arguments, I tend to assume that using 
= in an literal that starts with { is meant to be a dict.

In
>>> ages = {'Alice' = 22}

replacing the equal sign by either ==, :, or a comma would generate no 
SyntaxError.  Clearly (in my mind anyway, and in previous Python versions), the 
"bad token" is the equal sign, and not the string Alice.

Here's what I show with friendly:

==
>>> ages = {'Alice'=22}

Traceback (most recent call last):
  File "", line 1
ages = {'Alice'=22}
   ^
SyntaxError: invalid syntax
>>> why()

It is possible that you used an equal sign = instead of a colon : to assign 
values to keys in a dict before or at the
position indicated by ^.

=
Admitedly, this suggestion could also be wrong - but the focus on this case 
(imo) should be on the "bad token" shown, which should be the equal sign.

--

___
Python tracker 

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



[issue40975] contextlib.AsyncExitStack enter_async_context and aclose should be labeled as coroutine methods

2021-05-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +24863
pull_request: https://github.com/python/cpython/pull/26254

___
Python tracker 

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



[issue40975] contextlib.AsyncExitStack enter_async_context and aclose should be labeled as coroutine methods

2021-05-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24864
pull_request: https://github.com/python/cpython/pull/26255

___
Python tracker 

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



[issue40975] contextlib.AsyncExitStack enter_async_context and aclose should be labeled as coroutine methods

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 9a75cc604455962fd226b58ed033da92e68dd3c8 by Miss Islington (bot) 
in branch '3.9':
bpo-40975: [doc] Identify AsyncExitStack.enter_async_context()/aclose() as 
coroutine methods (GH-20870) (GH-26255)
https://github.com/python/cpython/commit/9a75cc604455962fd226b58ed033da92e68dd3c8


--

___
Python tracker 

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



[issue40975] contextlib.AsyncExitStack enter_async_context and aclose should be labeled as coroutine methods

2021-05-19 Thread Irit Katriel


Change by Irit Katriel :


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



[issue40975] contextlib.AsyncExitStack enter_async_context and aclose should be labeled as coroutine methods

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 65dede60fa15703b4625240fbe11af0060f5cbb0 by Miss Islington (bot) 
in branch '3.10':
bpo-40975: [doc] Identify AsyncExitStack.enter_async_context()/aclose() as 
coroutine methods (GH-20870) (GH-26254)
https://github.com/python/cpython/commit/65dede60fa15703b4625240fbe11af0060f5cbb0


--
nosy: +iritkatriel

___
Python tracker 

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



[issue11176] [doc] give more meaningful argument names in argparse documentation

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:

It's been over six years, go for it.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue37741] importlib.metadata docs not showing up in the module index

2021-05-19 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset ab1c3d99f51188d1a6b5f7797294b056279f62e0 by Miss Islington (bot) 
in branch '3.9':
bpo-37741: make importlib.metadata docs discoverable through a module 
directive. (GH-25415) (GH-25417)
https://github.com/python/cpython/commit/ab1c3d99f51188d1a6b5f7797294b056279f62e0


--

___
Python tracker 

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



[issue44181] SyntaxError in Python 3.10.0b1: wrong token for missing comma

2021-05-19 Thread Andre Roberge


New submission from Andre Roberge :

When forgetting a comma in writing a dict literal spanning multiple lines,
the "bad token" is wrongly idenfied with Python 3.10.0b1.

>>> a = {'a': 1
...  'b': 2
  File "", line 1
a = {'a': 1
  ^
SyntaxError: invalid syntax. Perhaps you forgot a comma?


Previously, this was shown:

>>> a = {'a': 1
...  'b': 2
  File "", line 2
'b': 2
^
SyntaxError: invalid syntax

However, I hasten to add that the new hint about a missing comma is spot on,
and likely to be extremely useful.

Note: this is based on my "intuition" built from previous version where the 
token identified by ^
was the first token that the Python parser was not able to make sense of.
Now that the parser highlight a range (if relevant tokens are on a single line),
it makes sense to include tokens preceding the "bad token".
However, when we have an error where such range
spans multiple lines, it can create "problems" such as that shown above.

Perhaps this is not worth attempting to fix and Python programmers like me will 
have to develop a "new intuition" in such cases (and "fix" friendly so that it 
can figure out the correct "bad token"
independently of cPython's information)
... and this bug report can be simply closed.

--
components: Parser
messages: 393976
nosy: aroberge, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: SyntaxError in Python 3.10.0b1: wrong token for missing comma
type: behavior
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



[issue44165] [sqlite3] sqlite3_prepare_v2 micro optimisation: pass string size

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Regarding the maximum length of an SQL string, quoting from 
https://sqlite.org/limits.html:
"The current implementation will only support a string or BLOB length up to 
2^31-1 or 2147483647. And some built-in functions such as hex() might fail well 
before that point. In security-sensitive applications it is best not to try to 
increase the maximum string and blob length. In fact, you might do well to 
lower the maximum string and blob length to something more in the range of a 
few million if that is possible."

The size returned from functions such as PyUnicode_AsUTF8AndSize is Py_ssize_t. 
I suggest checking the passed SQL string size and raising OverflowError if the 
SQL string is larger than 2^31-1.

--

___
Python tracker 

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



[issue44165] [sqlite3] sqlite3_prepare_v2 micro optimisation: pass string size

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Regarding the maximum length of an SQL string, quoting from 
https://sqlite.org/limits.html:
"The current implementation will only support a string or BLOB length up to 
2^31-1 or 2147483647. And some built-in functions such as hex() might fail well 
before that point. In security-sensitive applications it is best not to try to 
increase the maximum string and blob length. In fact, you might do well to 
lower the maximum string and blob length to something more in the range of a 
few million if that is possible."

The size returned from functions such as PyUnicode_AsUTF8AndSize is Py_ssize_t. 
I suggest checking the passed SQL string size and raising OverflowError if the 
SQL string is larger than SQLITE_MAX_LENGTH.

--

___
Python tracker 

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



[issue44165] [sqlite3] sqlite3_prepare_v2 micro optimisation: pass string size

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-05-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Few things incite me quite as much as being told that I'm not supposed to 
understand something, so now I'm actually making an effort to follow the ECOOP 
paper. Honestly, it's not too bad (a lot more readable than type theory papers 
:-). I'll get back to you once I'm more comfortable in mapping between that and 
minithesis.py.

--

___
Python tracker 

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



[issue44165] [sqlite3] sqlite3_prepare_v2 micro optimisation: pass string size

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

SQLITE_TOOBIG is currently mapped to sqlite3.DataError. In order to keep the 
current behaviour, DataError must be raised.

--

___
Python tracker 

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



[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-05-19 Thread Paul Ganssle


Paul Ganssle  added the comment:

I do not want to dissuade you from figuring out how minithesis / hypothesis 
works (far from it), but I'm wondering if the question of how shrinking works 
is germane to the issue at hand, which is whether or not hypothesis / 
property-based-testing is suitable for testing the standard library.

I almost don't think it matters *if* shrinking works, much less *how*. 
Shrinking is something of a UI nicety in the sense that when hypothesis finds 
an example that violates a property, it will try to take whatever example it 
has chosen and find something like a "minimal working example" to show to the 
end user. So if we have something like:

```
@given(x=strategies.integers())
def f(x):
assert x >= 0
```

Hypothesis will presumably tell us that `x == -1` will violate the property 
instead of `-24948929` or some other random thing. But if it did report 
`-24948929` or something, it wouldn't be too hard to see "oh, right, integers 
can be negative". In some cases with the time zone stuff, there isn't a good 
metric for complexity at the moment, so time zones are sorted by their IANA key 
(which is to say, basically arbitrary), and I generally find it useful anyway 
(admittedly, the shrinking still is helpful because most problems affecting all 
zones will return Africa/Abuja, whereas things particular to a specific zone's 
odd time zone history will return whichever zone with that quirk comes 
alphabetically first).

Anyway, do not let me disrupt your process, I just thought it might be worth 
making the point that some of these specific details might be nice to know, but 
don't seem like they should be blockers for hypothesis' adoption in the 
standard library.

--

___
Python tracker 

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



[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

2021-05-19 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue44037] Broad performance regression from 3.10a7 to 3.10b1 with python.org macOS binaries

2021-05-19 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue42892] AttributeError in email.message.get_body()

2021-05-19 Thread Irit Katriel


Irit Katriel  added the comment:

Can you see how it happened that part is a str?

--

___
Python tracker 

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



[issue44175] What do "cased" and "uncased" mean?

2021-05-19 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

See the docs for the title method on what they mean by "titlecased"; "a" is 
self-evidently not titlecased. 
https://docs.python.org/3/library/stdtypes.html#str.title

--

___
Python tracker 

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



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2021-05-19 Thread Dominik Vilsmeier


Dominik Vilsmeier  added the comment:

I wasn't aware of this issue so apparently I submitted a duplicate (#42722) 
half a year ago. The solution I implemented relies on simply calling 
`TestCase.debug`
and `TestSuite.debug` which makes it a lightweight change. From the perspective 
of the debugger the situation is thus no different than running a "normal" 
script. The other issue also has a pull request attached.

--
nosy: +Dominik V.

___
Python tracker 

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



[issue44182] python-config.sh vs python-config.py inconsistency

2021-05-19 Thread Todd C. Miller


New submission from Todd C. Miller :

There is an inconsistency between python-config.py and python-config.sh with 
the output of --ldflags.  The .sh version include -L$libdir but the .py version 
does not include the -L flag unless a non-shared version of Python is built.

As a result, on Darwin (macOS), where python-config.py is used it is not 
possible to use python-config to get the correct linker flags when 
"python-config --embed --ldflags" is run if Python is installed in a directory 
with a lib dir that is not in the compiler's default search path.

For example, if Python is installed in /usr/local/python, we see the following 
on Linux (using python-config.sh):

$ python3-config --ldflags --embed
 -L/usr/local/python/lib -lpython3.10 -lcrypt -lpthread -ldl  -lutil -lm -lm

But on macOS, using python-config.py:

$ python3-config --ldflags --embed
-lpython3.10 -lintl -ldl -framework CoreFoundation

There is no -L flag to tell the compiler where to find the python3.10 library, 
so an attempt to link with it will fail.

--
components: Installation
messages: 393985
nosy: millert
priority: normal
severity: normal
status: open
title: python-config.sh vs python-config.py inconsistency
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



[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-05-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

It is important to me, because I don't like having a dependency on
third-party code that is a black box. Remember that in the end it's not me
you have to convince but the SC.

--

___
Python tracker 

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



[issue43693] Logically merge cell and locals array. They are already contiguous in memory

2021-05-19 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +24865
pull_request: https://github.com/python/cpython/pull/26258

___
Python tracker 

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



[issue44163] IDLE ValueError in HyperParser

2021-05-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I constantly move back and forth between the editor and the shell, so am not 
sure where the issue occurred.  Also, I've never seen this one before so it 
isn't easily triggered.   Am running Python 3.9.5 in class.  Am not using a 
special build, it is the macOS build found on python.org.

--

___
Python tracker 

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



[issue44154] Optimize Fraction pickling

2021-05-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

You're right that this won't work for decimal because it takes a string 
constructor.  A fancier reduce might do the trick but it would involve 
modifying the C code (no fun) as well as the Python code.  Also, the conversion 
from decimal to string and back isn't quadratic, so we don't have the same 
worries.  Lastly, really large fractions happen naturally as they interoperate, 
but oversized decimals are uncommon.

--

___
Python tracker 

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



[issue44175] What do "cased" and "uncased" mean?

2021-05-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, the current terminology is confusing to me as well.

--
nosy: +rhettinger

___
Python tracker 

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



[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Steven, do you approve of this?

linear_regression(x, y) -> LinearRegression(slope, intercept)

--

___
Python tracker 

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



  1   2   >