[issue43828] MappingProxyType accepts string

2021-04-13 Thread Andy Maier


Andy Maier  added the comment:

I accept that the issue was closed, but wanted to document some things:

1. The dict class manages very well to detect that a string is invalid input:

>>> d = dict('abc')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: dictionary update sequence element #0 has length 1; 2 is required

2. When initialized with strings, it looses some of its dictionary methods, but 
does a quite reasonable job in pointing that out in the error message:

>>> mp = MappingProxyType('abc')
>>> mp.items()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'str' object has no attribute 'items'

--

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-13 Thread miss-islington


miss-islington  added the comment:


New changeset 57873af35aad98c6428b1718aaee4b16a82ea3f5 by Miss Islington (bot) 
in branch '3.9':
bpo-43777: Drop description of "pip search" command from tutorial (GH-25287)
https://github.com/python/cpython/commit/57873af35aad98c6428b1718aaee4b16a82ea3f5


--

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-13 Thread miss-islington


miss-islington  added the comment:


New changeset 6ac1ea25a2ba2aae742e191784cf73033b3ab332 by Miss Islington (bot) 
in branch '3.8':
bpo-43777: Drop description of "pip search" command from tutorial (GH-25287)
https://github.com/python/cpython/commit/6ac1ea25a2ba2aae742e191784cf73033b3ab332


--

___
Python tracker 

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



[issue43733] PEP 597: netrc uses locale encoding.

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue43752] [sqlite3] Fetching an empty value from date column raises ValueError

2021-04-13 Thread Lumír Balhar

Change by Lumír Balhar :


--
nosy: +frenzy

___
Python tracker 

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



[issue42578] Add tip when encountering UnicodeDecode/EncodeError in open()

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> wont fix
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



[issue41098] Deprecating PyUnicodeEncodeError_Create

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


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



[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2021-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

May I close this issue?

--

___
Python tracker 

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



[issue5758] fileinput.hook_compressed returning bytes from gz file

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


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



[issue43712] PEP 597: fileinput uses locale encoding

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


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



[issue43712] PEP 597: fileinput uses locale encoding

2021-04-13 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 333d10cbb53dd5f28d76f659a49bf0735f8509d8 by Inada Naoki in branch 
'master':
bpo-43712 : fileinput: Add encoding parameter (GH-25272)
https://github.com/python/cpython/commit/333d10cbb53dd5f28d76f659a49bf0735f8509d8


--

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24131
pull_request: https://github.com/python/cpython/pull/25399

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-13 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-13 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 133705b85cc25d1e6684d32f8943ca288fadfda0 by Bob Kline in branch 
'master':
bpo-43777: Drop description of "pip search" command from tutorial (GH-25287)
https://github.com/python/cpython/commit/133705b85cc25d1e6684d32f8943ca288fadfda0


--

___
Python tracker 

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



[issue43837] Operator precedence documentation could be more clear

2021-04-13 Thread Aidan Feldman


New submission from Aidan Feldman :

I am teaching a class on Python for people who are new to coding, and I was 
talking them through the operator precedence table:

https://docs.python.org/3/reference/expressions.html#operator-precedence

A couple things that confused the students:

- "Highest precedence" is on the bottom, while "lowest precedence" is on top
- There isn't any mention of variables. While not operators, probably worth 
mentioning that they (effectively?) have higher precedence than any of the 
operators.

I'd be happy to try making my first contribution to Python if there's interest 
in those edits. Also, I have an example breaking down operator precedence in 
practice here, which I could include:

https://colab.research.google.com/github/afeld/python-public-policy/blob/main/lecture_2.ipynb#scrollTo=UTxeT5RvqSFl

Thanks!

--
assignee: docs@python
components: Documentation
messages: 391030
nosy: aidan.feldman, docs@python
priority: normal
severity: normal
status: open
title: Operator precedence documentation could be more clear
type: enhancement
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-13 Thread Sergey B Kirpichev


Change by Sergey B Kirpichev :


--
nosy: +Sergey.Kirpichev

___
Python tracker 

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



[issue43836] range.index doesn't support start/stop optional arguments

2021-04-13 Thread Kaleb Barrett


New submission from Kaleb Barrett :

The range builtin type is a collections.abc.Sequence, which in Python 3.5 added 
the optional start and stop arguments to the index method of Sequences. 
However, range.index does not support these optional arguments required by 
Sequence.

I noticed this when creating a wrapper type around range which was a  Sequence. 
mypy complained 'Signature of "index" incompatible with supertype "Sequence"', 
but attempting to pass the values raised 'TypeError: index() takes exactly one 
argument (3 given)'.

--
components: Library (Lib)
messages: 391029
nosy: ktbarrett
priority: normal
severity: normal
status: open
title: range.index doesn't support start/stop optional arguments
type: behavior
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



[issue43813] Denial of service on http.server module with large request method.

2021-04-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



[issue43829] MappingProxyType cannot hash a hashable underlying mapping

2021-04-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Serhiy, what do you think?  Would it make sense to pass through the underlying 
hash?  I don't think there is much use for this but don't see any particular 
reason to block it.

--
nosy: +rhettinger, serhiy.storchaka
priority: normal -> low
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue43828] MappingProxyType accepts string

2021-04-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This isn't a bug because the MappingProxy doesn't promise to do early detection 
and because it can't really be accomplished cleanly.

Perfect detection of non-mappings isn't possible.  Some easy, minimal checks 
are made for early detection using PyMapping_Check, PyList_Check, and 
PyTuple_Check.  Anything that gets past those checks will just need to be 
duck-typed downstream when it is used.

We could add a few other specific exclusions but that isn't a general solution 
and it slows down instantiation.  Further it could break code that is intended 
to work (subclasses of str that mapping methods) or that just happen to work:

>>> from types import MappingProxyType
>>> mp = MappingProxyType('abc')
>>> mp[0]
'a'

--
nosy: +rhettinger
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



[issue38530] Offer suggestions on AttributeError and NameError

2021-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +24129
pull_request: https://github.com/python/cpython/pull/25397

___
Python tracker 

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



[issue38530] Offer suggestions on AttributeError and NameError

2021-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
title: Offer suggestions on AttributeError -> Offer suggestions on 
AttributeError and NameError

___
Python tracker 

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



[issue38530] Offer suggestions on AttributeError

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 37494b441aced0362d7edd2956ab3ea7801e60c8 by Pablo Galindo in 
branch 'master':
bpo-38530: Offer suggestions on AttributeError (#16856)
https://github.com/python/cpython/commit/37494b441aced0362d7edd2956ab3ea7801e60c8


--

___
Python tracker 

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



[issue43680] Deprecate undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-04-13 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: Remove undocumented io.OpenWrapper and _pyio.OpenWrapper -> Deprecate 
undocumented io.OpenWrapper and _pyio.OpenWrapper

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3bc694d5f3d4eb2e5d2f0b83e498b19662845d4e by Victor Stinner in 
branch 'master':
bpo-43680: Deprecate io.OpenWrapper (GH-25357)
https://github.com/python/cpython/commit/3bc694d5f3d4eb2e5d2f0b83e498b19662845d4e


--

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +24128
pull_request: https://github.com/python/cpython/pull/25395

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

Strictly speaking, adding any method is "potential" breaking change because 
hasattr(obj, "new_method") become from False to True. And since Python is 
dynamic language, any change is "potential" breaking change.

But we don't treat such change as breaking change. Practical beats purity.
We can use beta period to see is this change breaks real world application.

In case of staticmethod, I think creating a new thread in python-dev is ideal 
because it is language core feature. I will post a thread.

--

___
Python tracker 

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



[issue43835] Dataclasses don't call base class __init__

2021-04-13 Thread Eric V. Smith


Eric V. Smith  added the comment:

> The dataclass doesn't need to know what arguments the parent __init__ 
> accepts. It should consume the arguments it needs to initialize its instance 
> attributes, and forward the rest to the parent __init__.

The generated __init__() uses every parameter to initialize instance attributes 
(if we ignore InitVar). So are you saying it should call the base class with no 
parameters?

--

___
Python tracker 

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



[issue43835] Dataclasses don't call base class __init__

2021-04-13 Thread Paul Pinterits


Paul Pinterits  added the comment:

> dataclasses doesn't know the signature of the base class's __init__, so it 
> can't know how to call it.

The dataclass doesn't need to know what arguments the parent __init__ accepts. 
It should consume the arguments it needs to initialize its instance attributes, 
and forward the rest to the parent __init__.

> The typical way to handle this is for the derived class to add a 
> __post_init__() that calls into the base class's __init__().

How is that supposed to work? Like you said, the class doesn't know what 
arguments its parent constructor requires. If the derived class doesn't 
implement a custom __init__, @dataclass will generate one with an (probably) 
incorrect signature. Changing the signature is pretty much the only reason why 
you would need to implement a custom __init__, after all. For example:

```
@dataclasses.dataclass
class Foo:
foo: int

def __init__(self):
self.foo = 5

@dataclasses.dataclass
class Bar(Foo):
bar: int

def __post_init__(self):
super().__init__()

bar = Bar(1)  # TypeError: __init__() missing 1 required positional argument: 
'bar'
```

And even if this workaround actually worked, it would only be applicable if you 
*know* you're dealing with a dataclass and you'll have this problem. If you're 
writing something like a class decorator (similar to @dataclass), you don't 
know if the decorated class will be a dataclass or not. If it's a regular 
class, you can rely on the __init__s being chain-called. If it's a dataclass, 
you can't. Therefore, a class decorator that generates/replaces the __init__ 
method would need to take special care to be compatible with dataclasses, just 
because dataclasses don't follow basic OOP design principles.

Consider this trivial class decorator that generates an __init__ method:

```
def log_init(cls):
try:
original_init = vars(cls)['__init__']
except KeyError:
def original_init(self, *args, **kwargs):
super(cls, self).__init__(*args, **kwargs)

def __init__(self, *args, **kwargs):
print(f'{cls.__name__}.__init__ was called')
original_init(self, *args, **kwargs)

cls.__init__ = __init__
return cls

@log_init
@dataclasses.dataclass
class Foo:
foo: int

@dataclasses.dataclass
class Bar(Foo):
bar: int

Foo(1)  # Prints "Foo.__init__ was called"
Bar(1, 2)  # Prints nothing
```

How do you implement this in a way that is compatible with @dataclass?

--

___
Python tracker 

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



[issue43080] pprint for dataclass instances

2021-04-13 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks for all of the work, LewisGaul.

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



[issue43080] pprint for dataclass instances

2021-04-13 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 11159d2c9d6616497ef4cc62953a5c3cc8454afb by Lewis Gaul in branch 
'master':
bpo-43080: pprint for dataclass instances (GH-24389)
https://github.com/python/cpython/commit/11159d2c9d6616497ef4cc62953a5c3cc8454afb


--

___
Python tracker 

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



[issue38755] Long unicode string causes SyntaxError: Non-UTF-8 code starting with '\xe2' in file ..., but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

In 2012, I wrote detect_truncate.patch in bpo-14811. Does someone want to 
convert it to a PR for Python 3.9?

--

___
Python tracker 

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



[issue38755] Long unicode string causes SyntaxError: Non-UTF-8 code starting with '\xe2' in file ..., but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

The bpo-14811 issue was fixed in Python 3.10 by bpo-25643, but is not fixed in 
Python 3.8 and 3.9.

--
nosy: +vstinner

___
Python tracker 

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



[issue14811] decoding_fgets() truncates long lines and fails with a SyntaxError("Non-UTF-8 code starting with...")

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ok, let's continue the discussion on https://bugs.python.org/issue38755

--

___
Python tracker 

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



[issue43731] PEP 597: logging.fileConfig() uses locale encoding.

2021-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

> Ah, so you want to emit an EncodingWarning when fileConfig(filename) is 
> called without specifying an encoding, right?

Yes, but only when the user uses `PYTHONWARNDEFAULTENCODING`.

I already added `export PYTHONWARNDEFAULTENCODING=1` in `.bashrc` in my mac and 
Linux machine.

In the future, config file should be read with UTF-8 by default.

--

___
Python tracker 

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



[issue14811] decoding_fgets() truncates long lines and fails with a SyntaxError("Non-UTF-8 code starting with...")

2021-04-13 Thread Eryk Sun


Eryk Sun  added the comment:

> So that means we can close the issue, no?

This is a bug in 3.8 and 3.9, which need the fix to keep reading until "\n" is 
seen on the line. I arrived at this issue via bpo-38755 if you think it should 
be addressed there, but it's the same bug that's reported here.

--

___
Python tracker 

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



[issue43835] Dataclasses don't call base class __init__

2021-04-13 Thread Eric V. Smith


Eric V. Smith  added the comment:

dataclasses doesn't know the signature of the base class's __init__, so it 
can't know how to call it. I realize you've given an example that would accept 
any parameters, but that isn't typical.

What if the base class was:

@dataclasses.dataclass
class Foo:
foo: int

def __init__(self, baz):
...
pass

What would the generated Bar.__init__() look like if it were calling the base 
class __init__()? What would get passed to baz?

> So if a dataclass uses a custom __init__, all its child classes must also use 
> a custom __init__

This isn't true. The typical way to handle this is for the derived class to add 
a __post_init__() that calls into the base class's __init__(). This way, you 
can use the normally generated __init__() in the derived class, yet still call 
the base class's __init__() (which presumably you have some knowledge of). If 
that doesn't work for some reason (for example, you strictly require that the 
base class is initialized before the derived class, for some reason), then yes, 
you'd need to write a custom __init__() in the derived class. dataclasses isn't 
designed to handle every case: just the most common ones.

In your case, you could do:

@dataclasses.dataclass
class Bar(Foo):
bar: int

def __post_init__(self):
Foo.__init__(self, baz=self.bar) # or whatever

--
nosy: +eric.smith

___
Python tracker 

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



[issue43785] Remove RLock from BZ2File

2021-04-13 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 695d47b51e3e197de5448a1eb2f618bef6d59ac8 by Inada Naoki in branch 
'master':
bpo-43785: Update bz2 document (GH-25351)
https://github.com/python/cpython/commit/695d47b51e3e197de5448a1eb2f618bef6d59ac8


--

___
Python tracker 

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



[issue43785] Remove RLock from BZ2File

2021-04-13 Thread Inada Naoki


Change by Inada Naoki :


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



[issue43810] os.path.abspath returns invalid path (resolves symbolic link)

2021-04-13 Thread Eryk Sun


Eryk Sun  added the comment:

If realpath() resolves too much, you'll have to resolve manually via 
os.path.islink() and os.readlink(). If you need strict resolution, use 
pathlib.Path.resolve(). In strict mode it raises FileNotFoundError if a path 
component doesn't exist. Also, even in non-strict mode, it raises RuntimeError 
for a symlink loop.

--

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

> I got a false positive on my PR at 
> https://github.com/python/cpython/pull/25318/checks?check_run_id=2308871807

Oh, this CI failure was on Python 3.8.

Since Python 3.9, Python is now built with -fvisibility=hidden to avoid 
exporting symbols which are not explicitly exported. So in 3.9, we no longer 
have to ignore all symbols prefixed by "_Py".

--

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +24127
pull_request: https://github.com/python/cpython/pull/25394

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am going to revert the 3.9 PR as 3.9+ is hiding symbols by default.

--

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> $ objdump -T /lib64/libpython3.10.so.1.0|grep 
> _Py_M__importlib_bootstrap_external
# empty output

This was happening on 3.8 Victor:

root@d9c5942e274b:/src# objdump -T libpython3.8.so | grep 
_Py_M__importlib_bootstrap_external
00335740 gDO .rodatab062  Base
_Py_M__importlib_bootstrap_external

--

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> To skip ABI tests? I proposed to ignore ABI changes if they can be ignored 
> safely. But I don't know right now which changes can be ignored or not.

As the situation stands we need to choose on keeping my changes to ignore _Py 
function changes or revert it. Further than that is unexplored land

--

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

> Ok, then we need to revert by latest 2 PRs and add a new label or something 
> to skip

To skip ABI tests? I proposed to ignore ABI changes if they can be ignored 
safely. But I don't know right now which changes can be ignored or not.

--

___
Python tracker 

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



[issue43835] Dataclasses don't call base class __init__

2021-04-13 Thread Paul Pinterits


New submission from Paul Pinterits :

It's documented behavior that @dataclass won't generate an __init__ method if 
the class already defines one. It's also documented that a dataclass may 
inherit from another dataclass.

But what happens if you inherit from a dataclass that implements a custom 
__init__? Well, that custom __init__ is never called:

```
import dataclasses

@dataclasses.dataclass
class Foo:
foo: int

def __init__(self, *args, **kwargs):
print('Foo.__init__')  # This is never printed

@dataclasses.dataclass
class Bar(Foo):
bar: int

obj = Bar(1, 2)
print(vars(obj))  # {'foo': 1, 'bar': 2}
```

So if a dataclass uses a custom __init__, all its child classes must also use a 
custom __init__. This is 1) incredibly inconvenient, and 2) bad OOP. A child 
class should (almost) always chain-call its base class's __init__.

--
components: Library (Lib)
messages: 391006
nosy: Paul Pinterits
priority: normal
severity: normal
status: open
title: Dataclasses don't call base class __init__
versions: Python 3.10, 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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 25393 to micro-optimize _PyType_GetModuleByDef(). It reduces the 
overhead from +5.7 ns to +3.4 ns (-2.3 ns).

Well, I didn't check in depth if _PyType_GetModuleByDef() is the only change in 
functools.lru_cache() from Python 3.9 to master.

Compare master to Python 3.9:

Mean +- std dev: [py39] 37.5 ns +- 1.0 ns -> [master] 43.2 ns +- 0.7 ns: 1.15x 
slower

Compare PR 25393 to Python 3.9:

Mean +- std dev: [py39] 37.5 ns +- 1.0 ns -> [inline] 40.9 ns +- 1.0 ns: 1.09x 
slower

Compare PR 25393 to master:

Mean +- std dev: [master] 43.2 ns +- 0.7 ns -> [inline] 40.9 ns +- 1.0 ns: 
1.05x faster

--

___
Python tracker 

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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

> ./python -m pyperf timeit "from functools import lru_cache; f = 
> lru_cache(lambda: 42)" "f()" --compare-to ../3.9/python
> /home/pablogsal/github/3.9/python: . 2.60 us +- 0.05 us

You misused pyperf timeit: the two statements are run at each iteration of the 
benchmark.

I rerun the benchmark on Linux with PGO+LTO and CPU isolation:

Mean +- std dev: [py39] 37.5 ns +- 1.0 ns -> [master] 43.2 ns +- 0.7 ns: 1.15x 
slower

I understand that adding get_functools_state_by_type() has a cost of +5.7 ns on 
the performance of functions decorated with @lru_cache.

I used the commands:

./configure --enable-optimizations --with-lto
make
./python -m venv env
env/bin/python -m pip install pyperf
./env/bin/python -m pyperf timeit -s "from functools import lru_cache; f = 
lru_cache(lambda: 42)" "f()" -o master.json -v --duplicate=4096

--
stage: patch review -> resolved

___
Python tracker 

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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2021-04-13 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24126
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/25393

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

One thing we could consider as Serhiy proposed on the mailing list is to emit a 
Syntax Warning. The ambiguous cases are specially scary so I think that makes 
sense

--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Anthony Sottile


Anthony Sottile  added the comment:

here's quite a few other cases as well -- I'd love for this to be clarified in 
PEP8 such that I can rationalize crafting a rule for it in `pycodestyle` -- 
https://github.com/PyCQA/pycodestyle/issues/371

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread sco1


sco1  added the comment:

Appreciate the additional historical context, I also was pointed to this in the 
documentation: 
https://docs.python.org/3/reference/lexical_analysis.html#whitespace-between-tokens

If a parsing change is undesired from a backwards compatibility standpoint, 
would it be something that could be included in PEP 8?

--

___
Python tracker 

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



[issue43834] Use context manager in StringIO example

2021-04-13 Thread John Hagen


New submission from John Hagen :

The example for StringIO currently manually closes the object rather than using 
a context manager. Since this is likely the first code that a new user 
encounters and context managers reduce error-prone situations, I think it would 
be helpful to show usage as a context manager.

https://docs.python.org/3/library/io.html#io.StringIO.getvalue

Something like:

import io

with io.StringIO() as output:
output.write('First line.\n')
print('Second line.', file=output)

# Retrieve file contents -- this will be
# 'First line.\nSecond line.\n'
contents = output.getvalue()

# Context manager will automatically close
# object and discard memory buffer --
# .getvalue() will now raise an exception.

--
assignee: docs@python
components: Documentation
messages: 391000
nosy: John Hagen, docs@python
priority: normal
severity: normal
status: open
title: Use context manager in StringIO example
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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Precisely because examples like that changing this is a breaking change. Don't 
get me wrong: I would love to change it, but I don't know if is worth the risk

--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Better example:

>>> [0x1for x in (1,2)]
[31]

The code is parsed as [0x1f or x in (1,2)] instead of [0x1 for x in (1,2)] as 
you may expect.

--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

We tried changing this IIRC and it broke code in the stdlib (now reformatted) 
so it will break code in the wild. I am not sure the gains are worth it.

--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Hi. I'm totally confused about other keywords but I'm a little concerned about 
the "and", "or" operator when used on, not only "int" (also known as "long") 
but also most Python objects other then bool type.

Mostly when used on Python built-in objects "and", "or" keyword returns a very 
peculiar result. The "and" keyword returns the Python object on the left hand 
side while "or" returns the Python object on the right hand side. This applies 
to all Python object, built-in or user-defined, unless it has a specific 
__and__ or __or__ method defined. 

What is actually going on?

--
nosy: +shreyanavigyan

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good example! Similar issue was discussed on the mailing list 3 years ago
(https://mail.python.org/archives/list/python-...@python.org/thread/D2WPCITHG2LBQAP7DBTC6CY26WQUBAKP/#D2WPCITHG2LBQAP7DBTC6CY26WQUBAKP).
 Now with new example it perhaps should be reconsidered.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ok, then we need to revert by latest 2 PRs and add a new label or something to 
skip

--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is know behaviour unfortunately and cannot be changed because of backwards 
compatibility.

--
nosy: +pablogsal

___
Python tracker 

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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-13 Thread miss-islington


miss-islington  added the comment:


New changeset a607815eb07582deb3c5818be881a98abe25a100 by Miss Islington (bot) 
in branch '3.8':
[3.8] bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360) (GH-25392)
https://github.com/python/cpython/commit/a607815eb07582deb3c5818be881a98abe25a100


--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

It's not just about keywords. Eg '1x' tokenizes too but then produces a syntax 
error in the parser. Keywords are only special in that they can be used to 
write syntactically meaningful things with these concatenated numbers.

--
nosy: +Carl.Friedrich.Bolz

___
Python tracker 

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



[issue37179] asyncio loop.start_tls() provide support for TLS in TLS

2021-04-13 Thread Jordan Borean


Jordan Borean  added the comment:

Fantastic thanks, I'll keep watching the issue in the background as it sounds 
like it's under control.

--

___
Python tracker 

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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-13 Thread miss-islington


miss-islington  added the comment:


New changeset 5ce227f3a767e6e44e7c41e0c845a83cfca4 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360) (GH-25391)
https://github.com/python/cpython/commit/5ce227f3a767e6e44e7c41e0c845a83cfca4


--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Alistair Muldal


Alistair Muldal  added the comment:

Several other keywords seem to be affected, including `if`, `else`, `is`, and 
`in`

--
nosy: +alimuldal

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

In a Python stable version, I would suggest to only ignore an ABI change after 
a manual validation .Otherwise, we can miss real issues.

Well, I expect that at the beginning, we will discover many issues like 
_Py_M__importlib_bootstrap_external ;-)

--

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

> We could ignore all functions that start with _Py.

Some symbols starting with _Py are indirectly part of the ABI. Example of 
Include/cpython/pyctype.h:

#define Py_ISLOWER(c)  (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
PyAPI_DATA(const unsigned int) _Py_ctype_table[256];

Even if "_Py_ctype_table" is not directly part of the C API, it's technically 
part of the ABI.

If tomorrow, _Py_ctype_table is truncated to 128 items, it would be an 
incompatible ABI change.

--

___
Python tracker 

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



[issue43725] Create a release branch ABI stability regression test

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

> Oh wow, that's terrible... yet another good reason not to export data values.

_Py_M__importlib_bootstrap_external symbol doesn't seem to be exported. Why is 
it seen as a public symbol?

$ objdump -T /lib64/libpython3.10.so.1.0|grep 
_Py_M__importlib_bootstrap_external
# empty output

--

___
Python tracker 

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



[issue39232] asyncio crashes when tearing down the proactor event loop

2021-04-13 Thread Michael Hall


Change by Michael Hall :


--
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread sco1


sco1  added the comment:

Sorry, the bonus, while fun, I don't think is related

--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Rich rauenzahn


Change by Rich rauenzahn :


--
nosy: +rrauenza

___
Python tracker 

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



[issue43831] sqlite: convert_timestamp raises ValueError for empty columns

2021-04-13 Thread Erlend Egeberg Aasland

Erlend Egeberg Aasland  added the comment:

Hi Lumír, thank you for your report.

This is a duplicate of bpo-43752.

The bugfix currently is awaiting review, and will be included in python3.10b1 
(expected in approx. three weeks).

--
nosy: +berker.peksag, erlendaasland

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread Ned Batchelder


Change by Ned Batchelder :


--
nosy: +nedbat

___
Python tracker 

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



[issue43810] os.path.abspath returns invalid path (resolves symbolic link)

2021-04-13 Thread Rene Visser

Rene Visser  added the comment:

Thanks Eryk for your fast response. Apparently I somehow skipped the remark
about symbolic links in combination with abspath. Thank you for pointing
this out and apologies for wasting some of your time!!
Best wishes, Rene Visser

On Mon, Apr 12, 2021 at 7:40 AM Eryk Sun  wrote:

>
> Eryk Sun  added the comment:
>
> In POSIX, os.path.abspath(p) is normpath(join(os.getcwd(), p)). normpath()
> doesn't touch the filesystem, and it's documented that its "string
> manipulation may change the meaning of a path that contains symbolic
> links". You can use os.path.realpath() to resolve symbolic links in a path.
>
> --
> nosy: +eryksun
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

-- 

---

René Visser
Stuttgart, Germany
email: renevis...@gmail.com

---

--

___
Python tracker 

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



[issue43833] Unexpected Parsing of Numeric Literals Concatenated with Boolean Operators

2021-04-13 Thread sco1


New submission from sco1 :

Came across this riddle today:

>>> [0x_for x in (1, 2, 3)]
[15]

Initially I thought this was related to PEP 515 but the unexpected behavior 
extends to simpler examples as well, such as:

>>> x = 5
>>> 123or x
123
>>> 123and x
5

I'm not familiar enough with C to understand why this is being parsed/tokenized 
this way, but this seems like it should instead be a SyntaxError. This appears 
to be fairly old behavior, as the non-underscored version works back to at 
least 2.7.

And a bonus:

>>> 0x1decade or more
31378142

--
messages: 390981
nosy: sco1
priority: normal
severity: normal
status: open
title: Unexpected Parsing of Numeric Literals Concatenated with Boolean 
Operators
type: behavior
versions: Python 3.10, 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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24125
pull_request: https://github.com/python/cpython/pull/25392

___
Python tracker 

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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24124
pull_request: https://github.com/python/cpython/pull/25391

___
Python tracker 

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



[issue43811] Run GHA CI with multiple OpenSSL versions

2021-04-13 Thread miss-islington


miss-islington  added the comment:


New changeset 8fa1489365e7af8b90286c97db55a2dc60a05cde by Christian Heimes in 
branch 'master':
bpo-43811: Test multiple OpenSSL versions on GHA (GH-25360)
https://github.com/python/cpython/commit/8fa1489365e7af8b90286c97db55a2dc60a05cde


--
nosy: +miss-islington

___
Python tracker 

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



[issue41515] typing.get_type_hints generates KeyError

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

I see that all PRs are merged, and the CI issue is fixed as well. I close the 
issue.

commit eb77133564d74eb09ed63872a69b9827d4841b49
Author: Karthikeyan Singaravelan 
Date:   Tue Apr 13 19:24:23 2021 +0530

bpo41515: Fix assert in test which throws SyntaxWarning. (#25379)

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



[issue14811] decoding_fgets() truncates long lines and fails with a SyntaxError("Non-UTF-8 code starting with...")

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

With https://bugs.python.org/issue14811#msg160706 I get a SyntaxError on Python 
3.7, 3.8, 3.9 and 3.10.0a6. But I don't get an error on the master branch 
(Python 3.10.0a7+).

Eryk:
> The latest alpha release, 3.10a7, includes your rewrite of the tokenizer, and 
> in that case t33a.py no longer fails in Windows.

Oh ok, this issue was fixed by the following commit which is part of v3.10.0a7 
release:

commit 261a452a1300eeeae1428ffd6e6623329c085e2c
Author: Pablo Galindo 
Date:   Sun Mar 28 23:48:05 2021 +0100

bpo-25643: Refactor the C tokenizer into smaller, logical units (GH-25050)

--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Python tokenizer rewriting

___
Python tracker 

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



[issue43797] Improve syntax error for invalid comparisons

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 30ed93bfec5dfa7ee05982e2df8fd810f3f49305 by Pablo Galindo in 
branch 'master':
bpo-43797: Handle correctly invalid assignments inside function calls and 
generators (GH-25390)
https://github.com/python/cpython/commit/30ed93bfec5dfa7ee05982e2df8fd810f3f49305


--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2021-04-13 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you for the feedback.  

The new str() and repr() make more sense for Flag-based enumerations, and I'm 
hesitant to have different formats for Enum- vs Flag-based enums.

Would it be helpful to have another base Enum class to derive from that 
maintained the original str() and repr() formats?

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

___
Python tracker 

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



[issue14811] decoding_fgets() truncates long lines and fails with a SyntaxError("Non-UTF-8 code starting with...")

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> no longer fails in Windows.

So that means we can close the issue, no?

--

___
Python tracker 

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



[issue14811] decoding_fgets() truncates long lines and fails with a SyntaxError("Non-UTF-8 code starting with...")

2021-04-13 Thread Eryk Sun


Eryk Sun  added the comment:

> I don't get any error executing the t33a.py script

The second line in t33a.py is 1618 bytes. The standard I/O BUFSIZ in Linux is 
8192 bytes, but it's only 512 bytes in Windows. The latest alpha release, 
3.10a7, includes your rewrite of the tokenizer, and in that case t33a.py no 
longer fails in Windows.

--
nosy: +eryksun

___
Python tracker 

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



[issue43797] Improve syntax error for invalid comparisons

2021-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +24123
pull_request: https://github.com/python/cpython/pull/25390

___
Python tracker 

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



[issue43832] asyncio + multiprocessing = core dump in sem_trywait

2021-04-13 Thread Andrei Pozolotin


Change by Andrei Pozolotin :


Added file: https://bugs.python.org/file49957/dump_core.txt

___
Python tracker 

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



[issue43832] asyncio + multiprocessing = core dump in sem_trywait

2021-04-13 Thread Andrei Pozolotin


New submission from Andrei Pozolotin :

every attempt to touch multiprocessing.Event.is_set()
from asyncio.run() results in reproducible core dump in sem_trywait

system: Linux 5.11.8

Linux work3 5.11.8-arch1-1 #1 SMP PREEMPT Sun, 21 Mar 2021 01:55:51 + 
x86_64 GNU/Linux

Python: 3.9.2

https://archlinux.org/packages/extra/x86_64/python/

--
components: asyncio
files: dump_core.py
messages: 390973
nosy: Andrei Pozolotin, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio + multiprocessing = core dump in sem_trywait
type: crash
versions: Python 3.9
Added file: https://bugs.python.org/file49956/dump_core.py

___
Python tracker 

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



[issue3451] Asymptotically faster divmod and str(long)

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

Python has a reasonable efficiency up to 1000 decimal digits (according to 
benchmark) which is already really great! Operations with more than 1000 
decimal digits is an uncommon. IMO you should use a dedicated library like GMP 
for that.

I would prefer to keep CPython code simple enough to maintain. 
Objects/longobject.c is already 5744 lines of C code. longformat_BZ.diff adds 
around 700 lines of code, but it only makes str(int) starting at 2000 decimal 
digits.

Yeah, we could do better for integers with , but I would prefer 
not to :-) Python has a limited number of volunteers working on it, and it's 
not specialized in numbers. We should keep the maintenance burden at an 
acceptable level ;-)

--
resolution:  -> wont fix
stage: patch review -> resolved
status: languishing -> closed

___
Python tracker 

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



[issue3451] Asymptotically faster divmod and str(long)

2021-04-13 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

yes, that sounds fair. In PyPy we improve things occasionally if somebody feels 
like working on it, but in general competing against GMP is a fools errand.

--

___
Python tracker 

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



[issue40432] Pegen regenerate project for Windows not working

2021-04-13 Thread Ken Jin


Change by Ken Jin :


--
nosy: +kj
nosy_count: 2.0 -> 3.0
pull_requests: +24122
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/25389

___
Python tracker 

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



[issue3451] Asymptotically faster divmod and str(long)

2021-04-13 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue40432] Pegen regenerate project for Windows not working

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that the regeneration script is not detecting correctly that needs 
Python3.8+ for regenerating pegen. Check for instance:

https://buildbot.python.org/all/#/builders/596/builds/2/steps/2/logs/stdio

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue14811] decoding_fgets() truncates long lines and fails with a SyntaxError("Non-UTF-8 code starting with...")

2021-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I don't get any error executing the t33a.py script

--

___
Python tracker 

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



[issue3451] Asymptotically faster divmod and str(long)

2021-04-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

FWIW, I think we should close this; the same comments as in issue 26256 apply. 
See msg259408 onwards in that discussion.

--

___
Python tracker 

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



[issue14811] decoding_fgets() truncates long lines and fails with a SyntaxError("Non-UTF-8 code starting with...")

2021-04-13 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +BTaskaya, lys.nikolaou, pablogsal

___
Python tracker 

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



[issue43731] PEP 597: logging.fileConfig() uses locale encoding.

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

Ah, so you want to emit an EncodingWarning when fileConfig(filename) is called 
without specifying an encoding, right?

--

___
Python tracker 

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



[issue3451] Asymptotically faster divmod and str(long)

2021-04-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

> we have implemented a faster algorithm for divmod for big numbers using 
> Mark's fast_div.py in PyPy

Urk! I hope your implementation included a healthy dose of validation, testing 
and cleanup. :-) (I have no doubts that it did.)

I'd consider fast_div.py to be proof-of-concept code rather than something 
suitable for immediate use.

--

___
Python tracker 

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



[issue43830] (-1) ** 0.5 returns (6.123233995736766e-17+1j) instead of 1j

2021-04-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

FWIW, if you're specifically interested in complex square roots rather than 
powers in general, I'd recommend using `cmath.sqrt(value)` rather than 
`value**0.5` - there are fewer intermediate steps involved in computing 
`cmath.sqrt`, and the returned value will in general be a bit more accurate, 
and better defined in corner cases. (And probably slightly faster too, in the 
rare situations where that matters.)

--

___
Python tracker 

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



  1   2   >