[issue44229] Intermittent connection errors in ssl tests on macOS CI

2021-05-29 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Here's the output when with test.support.verbose = True:

test_ssl: testing with 'OpenSSL 1.1.1k  25 Mar 2021' (1, 1, 1, 11, 15)  
   
  under Mac ('11.3.1', ('', '', ''), 'x86_64')  
   
  HAS_SNI = True
   
  OP_ALL = 0x8054   
   
  OP_NO_TLSv1_1 = 0x1000
   
test_get_server_certificate (test.test_ssl.SimpleBackgroundTests) ...  server:  
new connection from ('127.0.0.1', 51163)

 server:  bad connection attempt from ('127.0.0.1', 51163): 
   
Traceback (most recent call last):
   File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2366, 
in wrap_conn   
self.sslconn = self.server.context.wrap_socket(
   File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 518, in 
wrap_socket
return self.sslsocket_class._create(
   File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 1070, in 
_create   
self.do_handshake()
   File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 1339, in 
do_handshake  
self._sslobj.do_handshake()
 OSError: [Errno 41] Protocol wrong type for socket 
   
ERROR

==  
   
ERROR: test_get_server_certificate (test.test_ssl.SimpleBackgroundTests)
   
--
Traceback (most recent call last):
  File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2130, 
in test_get_server_certificate  
_test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
  File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2327, 
in _test_get_server_certificate 
pem = ssl.get_server_certificate((host, port), ca_certs=cert)
  File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 1520, in 
get_server_certificate
with create_connection(addr, timeout=timeout) as sock:
  File "/Users/erlendaasland/src/cpython-ssl/Lib/socket.py", line 844, in 
create_connection
raise err
  File "/Users/erlendaasland/src/cpython-ssl/Lib/socket.py", line 832, in 
create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

-- 


The mock server fails with EPROTOTYPE, thus the client fails with connection 
refused.

I found similar issues after doing some googling:
- 
http://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
- https://github.com/benoitc/gunicorn/issues/1487#issuecomment-333680970

This might be the same macOS bug.

--

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-29 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +25046
pull_request: https://github.com/python/cpython/pull/26452

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



[issue44229] Intermittent connection errors in ssl tests on macOS CI

2021-05-30 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> It could be, but the same thing happens on Windows

Are you sure? All the reports are from macOS CI. Christian mentioned that it 
could be similar to another ssl test failure that also happen on Windows, but 
those tracebacks do not match the ones in this issue.

--

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



[issue43855] test_ssl: test_msg_callback_deadlock_bpo43577() failed on macOS of GitHub Action

2021-05-30 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

See also bpo-44229

--
nosy: +erlendaasland

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



[issue44229] Intermittent connection errors in ssl tests on macOS CI

2021-05-30 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

See also bpo-43855.

--

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



[issue44315] [sqlite3] remove unused connection argument from pysqlite_step()

2021-06-04 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

The code that used the connection argument was removed one year before pysqlite 
was included in CPython, as far as I can see. It can safely be removed.

See also:
https://github.com/ghaering/pysqlite/commit/5a009ed6fb2e90b952438f5786f93cd1e8ac8722

--
assignee: erlendaasland
components: Extension Modules
messages: 395117
nosy: erlendaasland
priority: low
severity: normal
status: open
title: [sqlite3] remove unused connection argument from pysqlite_step()
type: enhancement
versions: Python 3.11

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



[issue42213] Get rid of cyclic GC hack in sqlite3.Connection and sqlite3.Cache

2021-06-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44315] [sqlite3] remove unused connection argument from pysqlite_step()

2021-06-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44304] segmentation fault appeared in python 3.10.0b2

2021-06-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue44304] segmentation fault appeared in python 3.10.0b2

2021-06-04 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks Mike for the report and reproducer, and Pablo for the fix!

--

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



[issue42064] Convert sqlite3 to multi-phase initialisation (PEP 489)

2021-06-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-06-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

PR 26351 adds the Py_TPFLAGS_IMMUTABLETYPE type flag to all types converted to 
heap type during 3.10 development.

--

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



[issue44304] segmentation fault appeared in python 3.10.0b2

2021-06-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

sqlit3.Cursor is prone to the same bug. Do you want me to create a new issue 
for it, or can I reuse this issue number, Pablo? I'll see if I can create a 
reproducer for that as well.

--

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



[issue44326] [sqlite3] remove unused db member from pysqlite_Statement

2021-06-06 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

The db member of pysqlite_Statement is only "used" in the __init__ method. 
Suggesting to remove this. A couple of lines less of code, a couple of bytes 
less per statement object.

--
assignee: erlendaasland
components: Extension Modules
messages: 395216
nosy: erlendaasland
priority: low
severity: normal
status: open
title: [sqlite3] remove unused db member from pysqlite_Statement
type: enhancement

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



[issue44327] [sqlite3] remove unused members from pysqlite_Connection

2021-06-06 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

The timeout and timeout_started members of pysqlite_Connection are never used. 
Suggesting to remove them.

--
assignee: erlendaasland
components: Extension Modules
messages: 395219
nosy: erlendaasland
priority: low
severity: normal
status: open
title: [sqlite3] remove unused members from pysqlite_Connection
type: enhancement

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



[issue44327] [sqlite3] remove unused members from pysqlite_Connection

2021-06-06 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44326] [sqlite3] remove unused members from pysqlite_Statement

2021-06-06 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

The "sql" member is also unused. Removing this will make the tp_clear method 
redundant, as there are no PyObjects to clear anymore.

--
title: [sqlite3] remove unused db member from pysqlite_Statement -> [sqlite3] 
remove unused members from pysqlite_Statement

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



[issue44326] [sqlite3] remove unused db member from pysqlite_Statement

2021-06-06 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44326] [sqlite3] remove unused db member from pysqlite_Statement

2021-06-06 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

The db member of pysqlite_Statement is only "used" in the statement create 
method. Suggesting to remove this. A couple of lines less of code, a couple of 
bytes less per statement object.

--

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



[issue44326] [sqlite3] remove unused db member from pysqlite_Statement

2021-06-06 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44329] [sqlite3] refactor pysqlite_statement_create

2021-06-06 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

... to expand: so currently, if statement creation fails, we must deallocate 
the PyObject.

--

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



[issue44329] [sqlite3] refactor pysqlite_statement_create

2021-06-06 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Ah, I see I formulated myself a bit unclear:
Yes, we need to allocate/track every time. I just propose to do so as late as 
possible, in order to avoid allocating a PyObject before we know if it is 
possible to actually create the statement.

--

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



[issue44329] [sqlite3] refactor pysqlite_statement_create

2021-06-06 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Currently, pysqlite_statement_create() approx. looks like this:

1. some sanity checks (type, sql lenght, etc.)
2. allocate (PyObject_GC_New)
3. initialise members
4. determine if statement is a DML statement
5. create the statement (sqlite3_prepare_v2)
6. PyObject_GC_Track
7. check statement return value
8. more sanity checking
9. done!


Suggesting to refactor as this:
1. all sanity checks => early exit on failure
2. create the statement and validate return value
3. determine if statement is a DML statement => no need to do this if statement 
creation failed
4. allocate
5. initialise members
5. return


This will avoid unneeded allocations/GC tracking, it will avoid unneeded 
statement creation, and it will be more readable/maintainable.

--
assignee: erlendaasland
components: Extension Modules
messages: 395224
nosy: erlendaasland
priority: low
severity: normal
status: open
title: [sqlite3] refactor pysqlite_statement_create
type: enhancement

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



[issue44329] [sqlite3] refactor pysqlite_statement_create

2021-06-06 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44087] [sqlite3] consider adding Py_TPFLAGS_DISALLOW_INSTANTIATION to sqlite3.Statement

2021-06-06 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44329] [sqlite3] refactor pysqlite_statement_create

2021-06-06 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> I am not sure what you mean, in the happy path you still need to GC track and 
> allocate.

Currently, we allocate the object, then try to create the statement using the 
SQLite API. If we create the statement first, we can do the sanity check on the 
return value and just return NULL; then we can allocate the Py object and 
initialise the members.

--

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



[issue44331] Generate static PyCodeObjects for faster startup

2021-06-07 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue42514] Relocatable framework for macOS

2021-06-03 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue42213] Get rid of cyclic GC hack in sqlite3.Connection and sqlite3.Cache

2021-06-03 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +25108
pull_request: https://github.com/python/cpython/pull/26512

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-06-03 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +25110
pull_request: https://github.com/python/cpython/pull/26515

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



[issue42213] Get rid of cyclic GC hack in sqlite3.Connection and sqlite3.Cache

2021-06-03 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +25112
pull_request: https://github.com/python/cpython/pull/26517

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



[issue44041] [sqlite3] check that column count is updated correctly for cached statements

2021-06-04 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--

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



[issue44041] [sqlite3] optimisation: only call sqlite3_column_count when needed

2021-06-04 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

This change breaks existing behaviour (see test below). Also, 
sqlite3_column_count() is implemented as a simple lookup in SQLite; it is never 
an expensive function. Suggests to add the following test instead:


diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 77fafe0930..d7a3b249ab 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -555,6 +555,17 @@ def test_last_row_id_insert_o_r(self):
 ]
 self.assertEqual(results, expected)
 
+def test_column_count(self):
+# Check that column count is updated correctly for cached statements
+select = "select * from test"
+res = self.cu.execute(select)
+old_count = len(res.description)
+# Add a new column and execute the cached select query again
+self.cu.execute("alter table test add newcol")
+res = self.cu.execute(select)
+new_count = len(res.description)
+self.assertEqual(old_count - new_count, 1)
+
 
 class ThreadTests(unittest.TestCase):
 def setUp(self):

--

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



[issue42064] Convert sqlite3 to multi-phase initialisation (PEP 489)

2021-06-03 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Global module state has been established by 
f461a7fc3f8740b9e79e8874175115a3474e5930 (bpo-42862, GH-24203). We can safely 
migrate static variables into that struct as a next step.

--

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



[issue43988] Add test.support.assert_dissallow_instantiation

2021-05-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24985
pull_request: https://github.com/python/cpython/pull/26392

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



[issue43988] Add test.support.assert_dissallow_instantiation

2021-05-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24987
pull_request: https://github.com/python/cpython/pull/26394

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



[issue41930] Wrap sqlite3_serialize API in sqlite3 module

2021-05-22 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FYI, the pending release log of the upcoming SQLite 3.36.0 now mentions that 
these API's are enabled by default:

https://sqlite.org/releaselog/3_36_0.html

--

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24957
pull_request: https://github.com/python/cpython/pull/26368

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



[issue42792] [MacOS] Can't open file in a separate (threading.Thread) thread

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland
nosy_count: 4.0 -> 5.0
pull_requests: +24961
pull_request: https://github.com/python/cpython/pull/26372

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



[issue42792] [MacOS] Can't open file in a separate (threading.Thread) thread

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24962
pull_request: https://github.com/python/cpython/pull/26373

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24963
pull_request: https://github.com/python/cpython/pull/26372

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



[issue42792] [MacOS] Can't open file in a separate (threading.Thread) thread

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests:  -24962

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



[issue42792] [MacOS] Can't open file in a separate (threading.Thread) thread

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests:  -24961

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24964
pull_request: https://github.com/python/cpython/pull/26373

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



[issue42792] [MacOS] Can't open file in a separate (threading.Thread) thread

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24965
pull_request: https://github.com/python/cpython/pull/26373

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24959
pull_request: https://github.com/python/cpython/pull/26370

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24954
pull_request: https://github.com/python/cpython/pull/26363

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Christian, I've got a PR ready for Modules/_ssl.c, but I won't submit it if 
you'd rather do it yourself. I'll stay off the sha/md5 types unless you approve 
:)

--
nosy: +christian.heimes

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24960
pull_request: https://github.com/python/cpython/pull/26371

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks! Hashlib PR comin' up.

--

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



[issue44092] [sqlite3] Remove special rollback handling

2021-05-25 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Berker, does this look ok to you?

--
title: [sqlite3] consider removing special rollback handling -> [sqlite3] 
Remove special rollback handling

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



[issue44237] test_ssl randomly fails on macOS GH Action: test_get_server_certificate_sni() and test_get_server_certificate_timeout()

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue42972] [C API] Heap types (PyType_FromSpec) must fully implement the GC protocol

2021-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24966
pull_request: https://github.com/python/cpython/pull/26374

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



[issue44206] Add a version number to dict keys.

2021-05-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue44207] Add a version number to Python functions

2021-05-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue44229] Intermittent connection errors in ssl tests on macOS CI

2021-05-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FWIW:

1st shell:
$ ./python.exe -m test test_ssl -u all -m test_get_server_certificate -F
$ ps
[...]
 1271 ttys0040:01.00 ./python.exe -m test test_ssl -u all -m 
test_get_server_certificate -F

2nd shell:
$ sudo errinfo -p 1271

The syscall trace shows that errno 41 is returned by write():
  python.exewrite   41  Protocol wrong type for socket 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exe  connect   61  Connection refused 
  python.exe  connect   61  Connection refused 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exeioctl   25  Inappropriate ioctl for device 
  python.exe   stat642  No such file or directory

--

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



[issue42213] Get rid of cyclic GC hack in sqlite3.Connection and sqlite3.Cache

2021-05-31 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +25057
pull_request: https://github.com/python/cpython/pull/26462

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



[issue44263] Better explain the GC contract for PyType_FromSpecWithBases

2021-05-31 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue41676] asyncio.Event.wait broken link from asyncio.Event

2021-07-05 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Asyncio Event Documentation Links Incorrect

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



[issue41576] document BaseException in favour of bare except in error tutorial

2021-07-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Serhiy/Terry: Is further discussion needed? Can this be closed, or should the 
proposed PR be applied (after resolving any issues)?

--
nosy: +erlendaasland

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-07-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> Is anything left here?

Should the immutable flag also be applied to the heap types converted in and 
before Python 3.9 before closing this issue?

--

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



[issue44229] test_ssl: test_get_server_certificate() and test_msg_callback_deadlock_bpo43577() fail randomly on the macOS CI

2021-06-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

... should perhaps also return True in that case, but it does not seem to have 
any thing to say.

--

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



[issue43988] Add test.support.check_disallow_instantiation()

2021-06-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +25466
pull_request: https://github.com/python/cpython/pull/26889

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



[issue44229] test_ssl: test_get_server_certificate() and test_msg_callback_deadlock_bpo43577() fail randomly on the macOS CI

2021-06-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Using this patch, I'm (so far) no longer able to reproduce these test failures:

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index cee97a8302..c9c1546467 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2443,9 +2443,13 @@ def wrap_conn(self):
 self.server.conn_errors.append(str(e))
 if self.server.chatty:
 handle_error("\n server:  bad connection attempt from " + 
repr(self.addr) + ":\n")
-self.running = False
-self.server.stop()
-self.close()
+
+# bpo-44229, bpo-43855, bpo-44237, and bpo-33450:
+# Ignore spurious EPROTOTYPE returned by write() on macOS.
+if e.errno != errno.EPROTOTYPE and sys.platform != "darwin":
+self.running = False
+self.server.stop()
+self.close()
 return False
 else:
 
self.server.shared_ciphers.append(self.sslconn.shared_ciphers())



Running for 40 minutes now, right now passing 6k iterations for 
test_get_server_certificate, test_msg_callback_deadlock_bpo43577, and 
test_get_server_certificate_sni.

--

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-07-02 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +25562
pull_request: https://github.com/python/cpython/pull/27001

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-07-01 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

In inherit_slots() in Objects/typeobject.c, Py_TPFLAGS_HAVE_VECTORCALL 
inheritance depends on if the base type is a heap type or not. This aligns with 
PEP 590[1]:

  Heap types never inherit the vectorcall protocol because that
  would not be safe (heap types can be changed dynamically).

AFAICS, inherit_slots() should now use Py_TPFLAGS_IMMUTABLETYPE to decide if 
Py_TPFLAGS_HAVE_VECTORCALL can be inherited, and the PEP should be updated.


- [1] https://www.python.org/dev/peps/pep-0590/#subclassing

--

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



[issue44229] test_ssl: test_get_server_certificate() and test_msg_callback_deadlock_bpo43577() fail randomly on the macOS CI

2021-06-28 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I'd be interested in hearing Ronald's opinion. (Added to nosy.)

--
nosy: +ronaldoussoren

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



[issue44517] test__xxsubinterpreters: AMD64 Fedora Stable 3.x buildbot aborts at test_still_running

2021-06-26 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Builder: https://buildbot.python.org/all/#/builders/543

The buildbot has failed since 0982ded179f280176868c1c4eccf77bf70687816:
bpo-44032: Move pointer to code object from frame-object to frame specials 
array. (GH-26771)

Test stdio log attached.

--
components: Subinterpreters, Tests
files: test-stdio.txt
messages: 396546
nosy: Mark.Shannon, erlendaasland, pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test__xxsubinterpreters: AMD64 Fedora Stable 3.x buildbot aborts at 
test_still_running
type: crash
versions: Python 3.11
Added file: https://bugs.python.org/file50127/test-stdio.txt

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



[issue44517] test__xxsubinterpreters: AMD64 Fedora Stable 3.x buildbot aborts at test_still_running

2021-06-26 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Fatal Python error: Py_EndInterpreter: thread still has a frame
Python runtime state: initialized

Thread 0x7ff625ee4740 (most recent call first):
  File "", line 4 in 
make: *** [Makefile:1256: buildbottest] Aborted (core dumped)
program finished with exit code 2
elapsedTime=382.700268
test_still_running (test.test__xxsubinterpreters.DestroyTests) ...

--

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



[issue44229] test_ssl: test_get_server_certificate() and test_msg_callback_deadlock_bpo43577() fail randomly on the macOS CI

2021-06-28 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

But here, it is write() that returns EPROTOTYPE. See msg394798.

--

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



[issue44229] test_ssl: test_get_server_certificate() and test_msg_callback_deadlock_bpo43577() fail randomly on the macOS CI

2021-06-27 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I haven't observed this issue on the CI since GH-26893 through GH-26896 was 
merged. Marking this as resolved. If anyone disagrees, feel free to reopen :)

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

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



[issue42238] Deprecate suspicious.py?

2021-06-27 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

2021-07-08 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

These types now lack the Py_TPFLAGS_IMMUTABLETYPE flag:

## Types converted in Python 3.9

- _abc._abc_data
- _json.Encoder
- _json.Scanner
- _random.Random
- _struct.Struct
- _struct.unpack_iterator
- ast.AST
- posix.DirEntry
- posix.ScandirIterator
- select.devpoll
- select.epoll
- select.kevent
- select.kqueue
- select.poll
- zlib.Compress
- zlib.Decompress


## Types converted before Python 3.9

- _curses_panel.panel
- _tkinter.Tcl_Obj
- _tkinter.tkapp
- _tkinter.tktimertoken

--

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



[issue44517] test__xxsubinterpreters: AMD64 Fedora Stable 3.x buildbot aborts at test_still_running

2021-07-10 Thread Erlend E. Aasland

Erlend E. Aasland  added the comment:

FYI, this buildbot has been green after Victor's git clean adjustment in the 
buildbot repo.

I've been trying to reproduce the test_still_running failure on the buildbot, 
but have not been able to do so deterministically.

--

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



[issue44517] test__xxsubinterpreters: AMD64 Fedora Stable 3.x buildbot aborts at test_still_running

2021-07-10 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
status: open -> pending

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

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

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

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

--

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



[issue44092] [sqlite3] consider removing special rollback handling

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

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

--

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



[issue20587] sqlite3 converter not being called

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

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

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

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

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



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

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

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



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

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

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

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

--

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



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

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

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

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

--

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



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

2021-05-19 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



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

2021-05-19 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

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

--

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



[issue44976] [sqlite3] lazy creation of result rows

2021-08-22 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44976] [sqlite3] lazy creation of result rows

2021-08-22 Thread Erlend E. Aasland

New submission from Erlend E. Aasland :

Currently, we build the first result row in the _pysqlite_query_execute() loop 
if sqlite3_step() returned SQLITE_ROW. When the user asks for a row (for 
example, using sqlite3.Cursor.fetchone()), this pre-built row is returned, and 
the next row is prepared.

Suggesting to lazily build result rows instead.

Cons:
- no result tuples are built unless sqlite3.Cursor.fetch*() is called
- no need to keep the next result row (tuple) in pysqlite_Cursor; rows are 
built on demand
- pysqlite_cursor_iternext() is vastly simplified (50% less lines of code)
- the main loop in _pysqlite_query_execute() is further simplified

Cons:
- code churn


git diff main --shortstat: 2 files changed, 29 insertions(+), 58 deletions(-)

--
components: Extension Modules
messages: 400062
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] lazy creation of result rows
type: enhancement

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



[issue44976] [sqlite3] lazy creation of result rows

2021-08-22 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Historical note:
The current behaviour was introduced in pysqlite v2.0.2 (May 21 2005), in order 
to be able to finalise statements and thus close cursors as soon as possible. 
However, that effect was cancelled just after a couple of months, by the 
addition of the LRU cache and the ability to reuse prepared statements.

--

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



[issue44958] [sqlite3] only reset statements when needed

2021-08-20 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Ref. Serhiy's msg387858 in bpo-43350:
"Maybe the code could be rewritten in more explicit way and call 
pysqlite_statement_reset() only when it is necessary [...]"

Currently, we try to reset statements in all "statement exit" routes. IMO, it 
would be cleaner to just reset statements when we really need to:
1. before the first sqlite3_step() every time we (re)execute a query
2. at cursor exit, if there's an active statement
(3. in pysqlite_do_all_statements() ... see bpo-44092)

This will make the code easier to follow, and it will minimise the number of 
resets. The current patch is pretty small: 7 insertions(+), 33 deletions(-)

Pro:
- less lines of code, less maintenance
- cleaner exit paths
- optimise SQLite API usage
Con:
- code churn


If this is accepted, PR 25984 of bpo-44073 will be easier to land and review :)

--

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



[issue44958] [sqlite3] only reset statements when needed

2021-08-20 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44972] Add workflow_dispatch trigger for GitHub Actions jobs

2021-08-26 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Neat! Thanks :)

--

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



[issue45025] Reliance on C bit fields in C API is undefined behavior

2021-08-27 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +petr.viktorin

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



[issue44991] [sqlite3] cleanup callbacks (GIL handling, naming, ...)

2021-08-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

I'd like to propose further enhancements:
  - use intermingled declarations in the affected functions; this will make GIL 
acquisition stand more out, and it also improves readability and makes it 
easier to trace refs
  - take the naming step further: I'd like to normalise PyObject * callback 
variable names, the extremely long function_pinboard_* names, and also drop the 
C callback prefixes ('_' and 'pysqlite_')

If you agree, I'll create separate PR's for those; one for each refactor. I 
think it will enhance readability a lot.

--
title: [sqlite3] cleanup GIL handling -> [sqlite3] cleanup callbacks (GIL 
handling, naming, ...)

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



[issue44991] [sqlite3] cleanup GIL handling

2021-08-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44991] [sqlite3] cleanup GIL handling

2021-08-24 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Quoting msg400205 by Petr in bpo-42064:
I think the module could use a more comprehensive review for GIL handling, 
rather than doing it piecewise in individual PRs. I recommend that any function 
passed to SQLite (and only those) should
  - be named `*_callback`, for clarity
  - acquire the GIL at the very start
  - release the GIL at the very end

--
assignee: erlendaasland
components: Extension Modules
messages: 400207
nosy: erlendaasland, petr.viktorin
priority: normal
severity: normal
status: open
title: [sqlite3] cleanup GIL handling
type: enhancement

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



[issue42064] Convert sqlite3 to multi-phase initialisation (PEP 489)

2021-08-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Petr:
> I think the module could use a more comprehensive review for GIL handling 
> [...]

I agree. I created bpo-44991 for this.

--

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



[issue44997] [sqlite3] build fails on macOS 11.5.1

2021-08-26 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks, Ronald, that's a nice improvement. I'll create a PR for it.

--

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



[issue44997] [sqlite3] build fails on macOS 11.5.1

2021-08-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

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



[issue44997] [sqlite3] build fails on macOS 11.5.1

2021-08-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
keywords: +patch
pull_requests: +26427
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/27979

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



[issue42064] Convert sqlite3 to multi-phase initialisation (PEP 489)

2021-08-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> The state doesn't have a refcount, but it is owned by a module object, so 
> callback_context should own a reference to the module object.

Would it be sufficient to hold a reference to the connection object? The 
connection holds a reference to the connection type, and the connection type 
holds a reference to the module, right?

--

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



[issue44991] [sqlite3] cleanup callbacks (GIL handling, naming, ...)

2021-08-31 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +26531
pull_request: https://github.com/python/cpython/pull/28088

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



[issue42064] Convert sqlite3 to multi-phase initialisation (PEP 489)

2021-08-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks, good catch! I'll add that after PR 27934 is merged.

--

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



<    1   2   3   4   5   6   7   8   9   >