[issue38820] Make Python compatible with OpenSSL 3.0.0

2021-04-13 Thread Christian Heimes


Change by Christian Heimes :


--
dependencies: +OpenSSL 3.0.0: define OPENSSL_API_COMPAT 1.1.1, Run GHA CI with 
multiple OpenSSL versions

___
Python tracker 

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



[issue43799] OpenSSL 3.0.0: define OPENSSL_API_COMPAT 1.1.1

2021-04-13 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset b71aaa0df0f3a9640b034b4774651cd8c54d2fb9 by Christian Heimes in 
branch '3.8':
[3.8] bpo-43799: OpenSSL 3.0.0: declare OPENSSL_API_COMPAT 1.1.1 (GH-25329) 
(GH-25383)
https://github.com/python/cpython/commit/b71aaa0df0f3a9640b034b4774651cd8c54d2fb9


--

___
Python tracker 

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



[issue43799] OpenSSL 3.0.0: define OPENSSL_API_COMPAT 1.1.1

2021-04-13 Thread Christian Heimes


Change by Christian Heimes :


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



[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 Andrew Ushakov


Andrew Ushakov  added the comment:

Just tested again:

D:\Downloads>py 
  
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr  4 2021, 13:27:16) [MSC v.1928 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or"license" for more information.   
 
>>> quit()



  D:\Downloads>py 
tst112.py   
  
SyntaxError: Non-UTF-8 code starting with '\xe2' in file D:\Downloads\tst112.py 
on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ 
for details 

P.S. No problems with Python 3.8.5 and Ubuntu 20.04.2 LTS.

--
versions: +Python 3.7, 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 Christian Heimes


Christian Heimes  added the comment:

The new checks are only executed when one or more OpenSSL-related files are 
modified. The checks run a handful of networking and hashing test suites. All 
SSL checks are optional. This PR also introduces ccache to speed up 
compilation. In common cases it speeds up configure and compile time from about 
90 seconds to less than 30 seconds.

--
dependencies: +Run GHA CI with multiple OpenSSL versions

___
Python tracker 

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



[issue43827] abc conflicts with __init_subclass__

2021-04-13 Thread Vlad Hoi


New submission from Vlad Hoi :

from abc import ABC


class A:
def __init_subclass__(self):
pass


class B(ABC, A, name="name"):
pass


After initialising class B, this exception occurs, because multiple "name" 
arguments where provided:

Traceback (most recent call last):
  File "test_abc", line 9, in 
class B(ABC, A, name="name"):
TypeError: __new__() got multiple values for argument 'name'

--
components: Extension Modules
messages: 390933
nosy: vladhoi
priority: normal
severity: normal
status: open
title: abc conflicts with __init_subclass__
type: crash
versions: Python 3.8

___
Python tracker 

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



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

2021-04-13 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thanks for the reminder.
You are correct, the mentioned PR should set 
_SSLProtocolTransport._start_tls_compatible to True

--

___
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 Andy Maier


New submission from Andy Maier :

MappingProxyType objects can currently be initialized from a string object. 
Given is purpose, I think this is a bug and should result in TypeError being 
raised.

Example code (on CPython 3.9.1):

>>> from types import MappingProxyType
>>> mp = MappingProxyType('abc')
>>> list(mp)
['a', 'b', 'c']
>>> mp.items()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'str' object has no attribute 'items'

Other invalid input types are properly checked:

>>> mp = MappingProxyType(42)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: mappingproxy() argument must be a mapping, not int

>>> mp = MappingProxyType(['a'])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: mappingproxy() argument must be a mapping, not list

>>> mp = MappingProxyType(('a',))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: mappingproxy() argument must be a mapping, not tuple

--
components: Library (Lib)
messages: 390935
nosy: andymaier
priority: normal
severity: normal
status: open
title: MappingProxyType accepts string
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



[issue43828] MappingProxyType accepts string

2021-04-13 Thread Andy Maier


Change by Andy Maier :


--
type:  -> behavior

___
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 Andy Maier


New submission from Andy Maier :

Objects of MappingProxyType do expose a __hash__() method, but if the 
underlying mapping is hashable, it still does not support hashing it.

Example:

Content of mp_hash.py:

--
#!/usr/bin/env python

from nocasedict import NocaseDict, HashableMixin
from types import MappingProxyType

class HashableDict(HashableMixin, NocaseDict):
"""A hashable dictionary"""
pass

hd = HashableDict({'a': 1, 'b': 2})
print("hash(hd): {}".format(hash(hd)))

mp = MappingProxyType(hd)
print("hash(mp): {}".format(hash(mp)))
---

Running the mp_hash.py script:

hash(hd): 3709951335832776636
Traceback (most recent call last):
  File 
"/Users/maiera/Projects/Python/cpython/issues/mappingproxy/./mp_hash.py", line 
14, in 
print("hash(mp): {}".format(hash(mp)))
TypeError: unhashable type: 'mappingproxy'

There are use cases where a function wants to return an immutable view on an 
internal dictionary, and the caller of the function should be able to use the 
returned object like a dictionary, except that it is read-only.

Note there is https://bugs.python.org/issue31209 on the inability to pickle 
MappingProxyType objects which was closed without adding the capability. That 
would fall under the same argument.

--
components: Library (Lib)
messages: 390936
nosy: andymaier
priority: normal
severity: normal
status: open
title: MappingProxyType cannot hash a hashable underlying mapping
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



[issue43824] array.array.__deepcopy__() accepts a parameter of any type

2021-04-13 Thread MingZhe Hu


MingZhe Hu  added the comment:

copy.deepcopy() takes a memo argument for reason, but this memo object will not 
be used when passed to array.array.__deepcopy__(), that is, no matter called 
directly or not, as long as the C implementation of array.array.__deepcopy__() 
does not use the parameter(s) passed from the Python side, why not declare it 
using flag `METH_NOARGS`?

If I understand right, in following code, the memo passed to __deepcopy__() is 
meaningless:

https://github.com/python/cpython/blob/a4833883c9b81b6b272cc7c5b67fa1658b65304c/Lib/copy.py#L151-L153

--

___
Python tracker 

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



[issue43824] array.array.__deepcopy__() accepts a parameter of any type

2021-04-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I you declare a method as METH_NOARGS, you would not able to pass any argument 
to it.

I concur with Josh. There is nothing wrong here.

--
nosy: +serhiy.storchaka
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



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

2021-04-13 Thread Nathan Fallet


New submission from Nathan Fallet :

Complex exponentiation doesn't work as expected:

```
>>> (-1) ** 0.5
(6.123233995736766e-17+1j)
```

I think the issue is linked with this part of the code:
https://github.com/python/cpython/blob/32bd68c839adb7b42af12366ab0892303115d1d1/Objects/complexobject.c#L142-L151

--
messages: 390939
nosy: NathanFallet
priority: normal
severity: normal
status: open
title: (-1) ** 0.5 returns (6.123233995736766e-17+1j) instead of 1j
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



[issue3451] Asymptotically faster divmod and str(long)

2021-04-13 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

FWIW, we have implemented a faster algorithm for divmod for big numbers using 
Mark's fast_div.py in PyPy. In particular, this speeds up str(long) for large 
numbers significantly (eg calling str on the result of math.factorial(2**17) is 
now 15x faster than CPython ;-)).

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



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

2021-04-13 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +mark.dickinson

___
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


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



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

2021-04-13 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset c2b7a66b91cdb96fbfdb160f96797208ddc5e436 by Inada Naoki in branch 
'master':
bpo-43731: Add an `encoding` parameter to logging.fileConfig() (GH-25273)
https://github.com/python/cpython/commit/c2b7a66b91cdb96fbfdb160f96797208ddc5e436


--

___
Python tracker 

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



[issue43803] ctypes string_at/wstring_at - bad argument name used in docs and in docstring

2021-04-13 Thread Shreyan Avigyan


Change by Shreyan Avigyan :


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

___
Python tracker 

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



[issue43803] ctypes string_at/wstring_at - bad argument name used in docs and in docstring

2021-04-13 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

PR opened for this issue.

--

___
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 Eryk Sun


Eryk Sun  added the comment:

> P.S. No problems with Python 3.8.5 and Ubuntu 20.04.2 LTS.

The issue is that the line length is limited to BUFSIZ, which ends up splitting 
the UTF-8 sequence b'\xe2\x96\x91'. BUFSIZ is only 512 bytes in Windows. It's 
8192 bytes in Linux, in which case you need a line that's 16 times longer in 
order to reproduce the error. For example:

$ stat -c "%s" test.py 
8194
$ python3.9 test.py
SyntaxError: Non-UTF-8 code starting with '\xe2' in file 
/home/someone/test.py on line 1, but no encoding declared; see 
http://python.org/dev/peps/pep-0263/ for details

This has been fixed in a rewrite of the tokenizer (bpo-25643), for which the PR 
was recently merged into the main branch for 3.10a7+.

Maybe a minimal backport to keep reading up to "\n" can be applied to 3.8 and 
3.9.

--
nosy: +eryksun

___
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 Eryk Sun


Change by Eryk Sun :


--
stage: test needed -> needs patch
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



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

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

> fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None)

If "locale" is the intended default, why not being more explicit and use 
encoding="locale"?

--
nosy: +vstinner

___
Python tracker 

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



[issue42904] get_type_hints does not provide localns for classes

2021-04-13 Thread Ken Jin


Ken Jin  added the comment:

Yup I can! BTW, I agree with keeping the change in 3.10 only. I suspect it 
_may_ be backwards-incompatible in small edge cases (re: the long comment on 
the PR about suspicions with local and global scope).

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



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

2021-04-13 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

What do you mean? It works as I expected.  Can you explain what you expected, 
and why?

--
nosy: +steven.daprano

___
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 Steven D'Aprano


Steven D'Aprano  added the comment:

Before replying please read:

https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate

https://duckduckgo.com/?q=python+why+are+floating+point+so+inaccurate

--

___
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 Steven D'Aprano


Steven D'Aprano  added the comment:

Sorry Nathan, I worded my first response awkwardly, of course mathematically we 
should expect a result of 1j, by why do you expect it in a floating point 
calculation? Do you have an alternative?

(I promise this is my last comment until you have had a chance to reply.)

--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread Stefan Behnel


Stefan Behnel  added the comment:

The macros were moved to "Includes/cpython/", not to "Includes/internal/". That 
suggests to me that they should use "extern C", so that C++ code that wants to 
make use of CPython internals can use them.

Basically, the way I see it, *all* header files in "Includes/" and 
"Includes/cpython/" should work with C++ code and thus have an "extern C". Only 
the header files in "Includes/internal/" should not have them.

Regardless, I've removed the macro usage from Cython so that the current state 
doesn't hurt our users.

--

___
Python tracker 

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



[issue43646] ForwardRef name conflict during evaluation

2021-04-13 Thread Ken Jin


Ken Jin  added the comment:

@tefra, now that issue42904 has been solved, can you test your code again with 
3.10.0a8? (it's not out yet, so you may have to pull the code from CPython's 
GitHub master branch and build CPython)

Running your code again, it seems to be fixed:

Python 3.10.0a7+
>>> from typing import get_type_hints, Optional
>>> from a import Root as RootA, Person as PersonA
>>> from b import Root as RootB, Person as PersonB
>>> roota_hints = get_type_hints(RootA)
>>> rootb_hints = get_type_hints(RootB)
>>> print(roota_hints)
{'a': typing.List[a.Person]}
>>> print(rootb_hints)
{'b': typing.List[b.Person]}

However, it's still around for 3.9 and below if I use string annotations in 
classes. There's some discussion in that issue about why it may not be 
backported though.

--
status: open -> pending

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-04-13 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 9e7b2076fb4380987ad0262c4c0ca900b06475ad by Mark Shannon in 
branch 'master':
bpo-43760: Speed up check for tracing in interpreter dispatch (#25276)
https://github.com/python/cpython/commit/9e7b2076fb4380987ad0262c4c0ca900b06475ad


--

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

If we use `encoding="locale"` by default, EncodingWarning will be not be 
emitted  even when user omit `encoding` option.

--

___
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


Change by Eryk Sun :


--
versions: +Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 
3.4

___
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-04-13 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue43827] abc conflicts with __init_subclass__

2021-04-13 Thread Vlad Hoi


Change by Vlad Hoi :


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

___
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 Lumír Balhar

New submission from Lumír Balhar :

Hello.

I've discovered this issue when I was debugging a test failure in IPython. See 
this issue for more details (not needed): 
https://github.com/ipython/ipython/issues/12906

I'm testing this on Fedora Linux with Python 3.10.0a7 from our RPM package with 
SQLite 3.35.4.

I have a very simple SQLite database:

# sqlite3 test.sqlite 
SQLite version 3.35.4 2021-04-02 15:20:15
Enter ".help" for usage hints.
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE sessions (session integer
primary key autoincrement, start timestamp,
end timestamp, num_cmds integer, remark text);
INSERT INTO sessions VALUES(1,'2021-04-13 09:44:58.903345',NULL,NULL,'');
DELETE FROM sqlite_sequence;
INSERT INTO sqlite_sequence VALUES('sessions',1);
COMMIT;

When I query it without special converters, it works well:

# python3
>>> import sqlite3
>>> conn = sqlite3.connect('test.sqlite')
>>> c = conn.cursor()
>>> c.execute("SELECT * from sessions where session == 1").fetchone()
(1, '2021-04-13 09:44:58.903345', None, None, '')
>>>

but with detect_types=sqlite3.PARSE_DECLTYPES, it fails to parse the date and 
time:

# python3
>>> import sqlite3
>>> conn = sqlite3.connect('test.sqlite', detect_types=sqlite3.PARSE_DECLTYPES)
>>> c = conn.cursor()
>>> c.execute("SELECT * from sessions where session == 1").fetchone()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.10/sqlite3/dbapi2.py", line 67, in convert_timestamp
datepart, timepart = val.split(b" ")
ValueError: not enough values to unpack (expected 2, got 1)
>>>

With help of pdb in ipython, I've discovered that the value convert_timestamp 
gets to parse is an empty bytestring:

In [5]: c.execute("SELECT * from sessions where session == 1").fetchone()   
  
---
ValueErrorTraceback (most recent call last)
 in 
> 1 c.execute("SELECT * from sessions where session == 1").fetchone()

/usr/lib64/python3.10/sqlite3/dbapi2.py in convert_timestamp(val)
 65 
 66 def convert_timestamp(val):
---> 67 datepart, timepart = val.split(b" ")
 68 year, month, day = map(int, datepart.split(b"-"))
 69 timepart_full = timepart.split(b".")

ValueError: not enough values to unpack (expected 2, got 1)
> /usr/lib64/python3.10/sqlite3/dbapi2.py(67)convert_timestamp()
 65 
 66 def convert_timestamp(val):
---> 67 datepart, timepart = val.split(b" ")
 68 year, month, day = map(int, datepart.split(b"-"))
 69 timepart_full = timepart.split(b".")

ipdb> val   
  
b''
ipdb>

Is anything in my database wrong? It seems that the content of the start column 
is correct and covert_timestamp should be able to parse it. Is it possible that 
the troublemaker here is the empty column `end` of type timestamp?

Answer to my own question: yes, the issue here is that the column `end` is of 
type timestamp and it's empty. If I update it with a date and time, everything 
works:

# sqlite3 test.sqlite
sqlite> update sessions set end='2021-04-14 09:44:58.903345' where session = 1;
sqlite> select * from sessions;
1|2021-04-13 09:44:58.903345|2021-04-14 09:44:58.903345||
sqlite>

# python3
>>> import sqlite3
>>> conn = sqlite3.connect('test.sqlite', detect_types=sqlite3.PARSE_DECLTYPES)
>>> c = conn.cursor()
>>> c.execute("SELECT * from sessions where session == 1").fetchone()
(1, datetime.datetime(2021, 4, 13, 9, 44, 58, 903345), datetime.datetime(2021, 
4, 14, 9, 44, 58, 903345), None, '')

So, the final question is whether this is correct behavior. I believe that 
columns without content should not be passed to converters.

--
components: Library (Lib)
messages: 390953
nosy: frenzy
priority: normal
severity: normal
status: open
title: sqlite: convert_timestamp raises ValueError for empty columns
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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 54db51c9114ac49030832f5134979ca866ffd21c by Andrew V. Jones in 
branch 'master':
bpo-43816: Add extern "C" to Include/cpython/pyctype.h (GH-25365)
https://github.com/python/cpython/commit/54db51c9114ac49030832f5134979ca866ffd21c


--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +24119
pull_request: https://github.com/python/cpython/pull/25386

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24120
pull_request: https://github.com/python/cpython/pull/25387

___
Python tracker 

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



[issue43770] Rework C types initialization

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 65f058eb081c9e1fe44115d1ac7966067e3650c7 by Victor Stinner in 
branch 'master':
bpo-43770: Reorder type_ready() (GH-25373)
https://github.com/python/cpython/commit/65f058eb081c9e1fe44115d1ac7966067e3650c7


--

___
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 Florian Bruhin


Florian Bruhin  added the comment:

I'm probably a bit late to the party as well, but as some additional datapoints:

- This broke the tests for my project and I ended up adding a wrapper to 
stringify enums (since I actually prefer having the enum type in debug logs and 
such): 
https://github.com/qutebrowser/qutebrowser/commit/e2c5fe6262564d9d85806bfa9d4486a411cf5045
- This broke tests for pytest, and also changes its test IDs when enums are 
used for test parametrization, which might cause more breakage downstream: 
https://github.com/pytest-dev/pytest/issues/8546

--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread miss-islington


miss-islington  added the comment:


New changeset 47a894d338f436ea8f513f1ad2cc7e1b086e99cc by Miss Islington (bot) 
in branch '3.8':
bpo-43816: Add extern "C" to Include/cpython/pyctype.h (GH-25365)
https://github.com/python/cpython/commit/47a894d338f436ea8f513f1ad2cc7e1b086e99cc


--

___
Python tracker 

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



[issue2824] zipfile to handle duplicate files in archive

2021-04-13 Thread Felix C. Stegerman


Change by Felix C. Stegerman :


--
nosy: +obfusk

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 15ad30d88fead718b7eeff8c54454b82753d520e by Miss Islington (bot) 
in branch '3.9':
bpo-43816: Add extern "C" to Include/cpython/pyctype.h (GH-25365) (GH-25387)
https://github.com/python/cpython/commit/15ad30d88fead718b7eeff8c54454b82753d520e


--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

It's now fixed. Thanks Andrew V. Jones for the fix.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

The workaround for this issue is to put extern "C" around #include , 
or around the header file which includes .

--

___
Python tracker 

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



[issue43770] Rework C types initialization

2021-04-13 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24121
pull_request: https://github.com/python/cpython/pull/25388

___
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 Serhiy Storchaka

Serhiy Storchaka  added the comment:

It is the same "gotcha" as

>>> math.cos(math.pi/2)
6.123233995736766e-17

You can expect that cos(π/2) is exactly 0, but floating point value math.pi is 
only an approximation of the π number. The difference between math.pi and exact 
value of π leads to non-zero result of cos(math.pi/2).

--
nosy: +serhiy.storchaka

___
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 Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue43770] Rework C types initialization

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a328d73843cfd42d2aee1434c78df1ef2845931a by Victor Stinner in 
branch 'master':
bpo-43770: Cleanup type_ready() (GH-25388)
https://github.com/python/cpython/commit/a328d73843cfd42d2aee1434c78df1ef2845931a


--

___
Python tracker 

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



[issue43816] Missing 'extern "C"' for _Py_ctype_table

2021-04-13 Thread STINNER Victor

STINNER Victor  added the comment:

Stéphane Wirtel: "In fact, _Py_ctype_table is limited to the internal parts of 
the interpreter. So in this case, this one could not be used in an external 
tool. You can read: https://docs.python.org/3/c-api/stable.html";

You're right that pyctype.h is excluded from the limited C API. But almost all 
C extensions use the "regular" C API which includes header files in 
Include/cpython/.

The internal C API is something different: header files in Include/internal/.

I know that it's complicated, that why a README was written :-)
https://github.com/python/cpython/blob/master/Include/README.rst

--

___
Python tracker 

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



[issue43770] Rework C types initialization

2021-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

If I modify type_ready() to call type_ready_inherit() before 
type_ready_fill_dict(), some types create a between between their C slot 
(tp_init) and the Python API in tp_dict (tp_dict["__init__"]).

Example with importlib:

class FileLoader(...):
def __init__(...):
...

=> FileLoader.tp_init = slot_tp_init

class SourceFileLoader(FileLoader):
...


When PyType_Ready() is called on SourceFileLoader, we get:

* SourceFileLoader.tp_base = FileLoader
* SourceFileLoader.tp_init = NULL
* SourceFileLoader.tp_dict has no "__init__" key

When inherit_slots() is called, SourceFileLoader.tp_init is set to 
slot_tp_init().

When add_operators() is called, SourceFileLoader.tp_dict["__init__"] is set to 
PyDescr_NewWrapper(slot_tp_init).

Problem: we a loop! tp_dict["__init__"] => slot_tp_init => tp_dict["__init__"]

--

___
Python tracker 

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



[issue43817] Add typing.get_annotations()

2021-04-13 Thread Ken Jin


Change by Ken Jin :


--
nosy: +kj

___
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



[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



[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



[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



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



[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



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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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


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



[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



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



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



[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



[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



[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



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

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



[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



[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



[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



[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



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



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



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

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



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



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



  1   2   >