[issue44047] [sqlite3] remove unused argument from _pysqlite_seterror()
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +24584 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25915 ___ Python tracker <https://bugs.python.org/issue44047> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44047] [sqlite3] remove unused argument from _pysqlite_seterror()
New submission from Erlend Egeberg Aasland : Suggesting to remove the statement pointer argument from _pysqlite_seterror(), as it has been unused since commit 525269430a3f9fbb7287e4bb6b365ac216004980. -- components: Extension Modules messages: 393001 nosy: berker.peksag, erlendaasland, serhiy.storchaka priority: normal severity: normal status: open title: [sqlite3] remove unused argument from _pysqlite_seterror() versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue44047> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44042] [sqlite3] _pysqlite_connection_begin() optimisations
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +24576 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25908 ___ Python tracker <https://bugs.python.org/issue44042> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44042] [sqlite3] _pysqlite_connection_begin() optimisations
New submission from Erlend Egeberg Aasland : The following optimisations can be applied to _pysqlite_connection_begin(): 1. Return an int instead of a PyObject pointer Per now, we do Py_RETURN_NONE and Py_DECREF(result) if _pysqlite_connection_begin() was successful (normally the case). There's no reason to do this. Let's just it the C way: return -1 on error and 0 if things are ok. 2. Defer error checking till post sqlite3_finalize() Any error code returned by sqlite3_step() will also be returned by sqlite3_finalize() for the same statement. From the SQLite docs: "If the most recent evaluation of statement S failed, then sqlite3_finalize(S) returns the appropriate error code or extended error code." 3. Move _pysqlite_connection_begin() to Modules/_sqlite/cursor.c The single use is in _pysqlite_query_execute() in cursor.c. Moving it makes it possible for the compiler to apply more optimisations. At least so I've heard :) (As a side effect, the namespace will be cleaner.) -- messages: 392967 nosy: berker.peksag, erlendaasland, serhiy.storchaka priority: normal severity: normal status: open title: [sqlite3] _pysqlite_connection_begin() optimisations type: performance versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue44042> ___ ___ 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
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +24575 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25907 ___ 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
New submission from Erlend Egeberg Aasland : Pr. now, we call sqlite3_column_count() for every iteration in the _pysqlite_query_execute() loop. If detect_types is set, we call it twice for every loop. Suggesting to move it out of the loop and into the pysqlite_Statement object. In pysqlite_statement_create(), after sqlite3_prepare_v2(), if self->is_dml == 0 we fetch the column count: self->column_count = sqlite3_column_count(). Else, it's 0. # SQLite API interaction examples (pseudo-code), as diffs --- now +++ patched ## Create table sqlite3_prepare_v2 +sqlite3_column_count sqlite3_bind_blob_parameter_count sqlite3_step -sqlite3_column_count sqlite3_last_insert_rowid sqlite3_reset ## Triple insert (executemany) sqlite3_prepare_v2 sqlite3_get_autocommit sqlite3_bind_blob_parameter_count sqlite3_bind_int64 sqlite3_step -sqlite3_column_count sqlite3_changes sqlite3_reset sqlite3_bind_blob_parameter_count sqlite3_bind_int64 sqlite3_step -sqlite3_column_count sqlite3_changes sqlite3_reset sqlite3_bind_blob_parameter_count sqlite3_bind_int64 sqlite3_step -sqlite3_column_count sqlite3_changes sqlite3_reset -- components: Extension Modules messages: 392964 nosy: berker.peksag, erlendaasland, serhiy.storchaka priority: normal severity: normal status: open type: enhancement versions: Python 3.11 ___ 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
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Erlend Egeberg Aasland added the comment: Thanks, Steve, that means a lot! Glad to help. Thank you for getting it into beta1. Having the new event out there with the wrong object passed to it would have been a tiny bit embarrassing :) -- ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Change by Erlend Egeberg Aasland : -- pull_requests: +24513 pull_request: https://github.com/python/cpython/pull/25825 ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Change by Erlend Egeberg Aasland : -- pull_requests: +24510 pull_request: https://github.com/python/cpython/pull/25823 ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Change by Erlend Egeberg Aasland : -- pull_requests: +24509 stage: backport needed -> patch review pull_request: https://github.com/python/cpython/pull/25822 ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Erlend Egeberg Aasland added the comment: Thanks! :) I'll fix the backports. -- ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Erlend Egeberg Aasland added the comment: Steve, can we get this in before beta1 (bco. the bugfix)? -- ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Erlend Egeberg Aasland added the comment: The PR accidentally fixes a bug in GH-25246 (bpo-43762): The object passed to PySys_Audit() is now the connection object, not the module object. -- ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Change by Erlend Egeberg Aasland : -- pull_requests: +24504 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25818 ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ 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
Change by Erlend Egeberg Aasland : -- pull_requests: +24502 pull_request: https://github.com/python/cpython/pull/25816 ___ 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
Erlend Egeberg Aasland added the comment: Victor: > And in the "Porting to Python 3.10", I don't know if we should suggest > reviewing metatypes implemented in C which overrides tp_setattro, to take the > new flag in account. I don't know either; perhaps someone else could chime in here. I've added a draft of a minimal What's New (PR comin' up in a few seconds). -- ___ 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
[issue43916] Mark static types newly converted to heap types as immutable: add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag
Erlend Egeberg Aasland added the comment: > Not sure what do you have in mind for the wiki See https://meta.discourse.org/t/what-is-a-wiki-post/30801 -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43901] Lazy-create an empty annotations dict in all unannotated user classes and modules
Erlend Egeberg Aasland added the comment: test_grammar also needed a fix. It has been updated to use import_helper.import_fresh_module in bpo-43995 (GH-25764). -- nosy: +erlendaasland ___ Python tracker <https://bugs.python.org/issue43901> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Mark static types newly converted to heap types as immutable: add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag
Erlend Egeberg Aasland added the comment: > These lists are not complete, for example select.kevent was not listed > whereas it has a bug. If one of the admins could make that post into a wiki post, it would be open for editing, making it easier to fill the holes in the lists. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43995] test_grammar fails if run sequentially
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +24457 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25764 ___ Python tracker <https://bugs.python.org/issue43995> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43995] test_grammar fails if run sequentially
New submission from Erlend Egeberg Aasland : To reproduce: $ ./python.exe -m test test_typing test_grammar 0:00:00 load avg: 1.95 Run tests sequentially 0:00:00 load avg: 1.95 [1/2] test_typing 0:00:00 load avg: 1.95 [2/2] test_grammar test test_grammar failed -- Traceback (most recent call last): File "/Users/erlendaasland/src/cpython-support/Lib/test/test_grammar.py", line 396, in test_var_annot_in_module with self.assertRaises(NameError): AssertionError: NameError not raised test_grammar failed == Tests result: FAILURE == 1 test OK. 1 test failed: test_grammar Total duration: 969 ms Tests result: FAILURE -- components: Tests messages: 392532 nosy: erlendaasland, pablogsal priority: normal severity: normal status: open title: test_grammar fails if run sequentially versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue43995> ___ ___ 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
Erlend Egeberg Aasland added the comment: I'll fix your typo ;) I'll include the rest of the test in the PR. I just pushed it out quickly to get a review of the solution. -- ___ 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
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +24447 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25757 ___ 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
[issue43916] Mark static types newly converted to heap types as immutable: add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag
Erlend Egeberg Aasland added the comment: Yes, the sqlite3 types are fine. I don't know why I included them in my earlier post. I cleared the tp_new markings for the sqlite3 types on the Discourse post, since I can edit my posts over there, contrary to here on bpo :) -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ 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
Change by Erlend Egeberg Aasland : -- type: -> enhancement ___ 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
New submission from Erlend Egeberg Aasland : See https://github.com/python/cpython/pull/25748#discussion_r623849521: "What do you think of adding support.assert_disallow_instanciation(type, *args) function which would check for TypeError but also check the error message? TypeError is quite generic and it might hide a bug." Ref. bpo-43916. -- components: Tests messages: 392436 nosy: erlendaasland, vstinner priority: normal severity: normal status: open title: Add test.support.assert_dissallow_instantiation ___ 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
[issue43916] Mark static types newly converted to heap types as immutable: add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag
Erlend Egeberg Aasland added the comment: Pablo & Serhiy, can we close this issue now? -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Mark static types newly converted to heap types as immutable: add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag
Change by Erlend Egeberg Aasland : -- pull_requests: +24439 pull_request: https://github.com/python/cpython/pull/25750 ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Mark static types newly converted to heap types as immutable: add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag
Change by Erlend Egeberg Aasland : -- pull_requests: +24437 pull_request: https://github.com/python/cpython/pull/25748 ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ 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
Erlend Egeberg Aasland added the comment: Yes, I’ll have a look at it this afternoon. (On mobile now.) -- ___ 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
[issue24912] The type of cached objects is mutable
Change by Erlend Egeberg Aasland : -- nosy: +erlendaasland nosy_count: 17.0 -> 18.0 pull_requests: +24435 pull_request: https://github.com/python/cpython/pull/25714 ___ Python tracker <https://bugs.python.org/issue24912> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check
Erlend Egeberg Aasland added the comment: > Do you think that something should be changed? If yes, please open a new > separated issue. No, my comment was just for information :) -- ___ Python tracker <https://bugs.python.org/issue43973> ___ ___ 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
Erlend Egeberg Aasland added the comment: Included in GH-25743 -- ___ 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
Erlend Egeberg Aasland added the comment: I just found it myself :) pushing out the PR now! -- ___ 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
Change by Erlend Egeberg Aasland : -- pull_requests: +24433 pull_request: https://github.com/python/cpython/pull/25743 ___ 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
Erlend Egeberg Aasland added the comment: Yep, I agree. From my coverage output, it seems that this branch is never executed. BUT, that may of course be because there's no test that exercises this branch. -- ___ 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
[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check
Change by Erlend Egeberg Aasland : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue43973> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check
Erlend Egeberg Aasland added the comment: Ok! Did you see bpo-24912 regarding the ModuleType check? -- ___ Python tracker <https://bugs.python.org/issue43973> ___ ___ 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
Erlend Egeberg Aasland added the comment: Victor: > check_set_special_type_attr() is used to prevent setting the following > attributes: > [...] > Right now, I cannot set the attribues on array.array type: > [...] > I guess that type_setattro() is used and it checks for > Py_TPFLAGS_IMMUTABLETYPE flag early. Is this always the case? If so, can we turn the check in check_set_special_type_attr() into an assert? In any case, Py_TPFLAGS_IMMUTABLETYPE should be used, not !Py_TPFLAGS_HEAPTYPE. -- ___ 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
[issue43851] Optimise SQLite builds on macOS and Windows
Erlend Egeberg Aasland added the comment: If Berker does not disapprove, I'd like to apply GH-25413 and GH-25414 to the installers, Steve & Ned. -- ___ Python tracker <https://bugs.python.org/issue43851> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks
Erlend Egeberg Aasland added the comment: Steve, is it worth it to improve this? -- ___ Python tracker <https://bugs.python.org/issue43434> ___ ___ 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
Erlend Egeberg Aasland added the comment: > check_set_special_type_attr() must also be updated to check for > Py_TPFLAGS_IMMUTABLETYPE flag. Ok, lets just use this issue for the PR. I can fix it in an hour or so. -- ___ 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
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Serhiy, would you mind reviewing the PR? bpo-43974 will clean up the changes introduced to setup.py. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ 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
Change by Erlend Egeberg Aasland : -- pull_requests: +24404 pull_request: https://github.com/python/cpython/pull/25714 ___ 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
[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +24403 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25714 ___ Python tracker <https://bugs.python.org/issue43973> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check
Erlend Egeberg Aasland added the comment: IMO, we can drop most (all?) of the huge comment before the check in object_set_class(). History is preserved in the git log. Contrary to Py_TPFLAGS_HEAPTYPE, using Py_TPFLAGS_IMMUTABLETYPE speaks for itself. We might reduce it to just refer to to bpo-43908 and bpo-24912. Something a la this: /* Historically, only static types were immutable. * Py_TPFLAGS_IMMUTABLETYPE was introduced in Python 3.10. * See bpo-43908 and bpo-24912. */ What do you think? -- ___ Python tracker <https://bugs.python.org/issue43973> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43973] Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check
New submission from Erlend Egeberg Aasland : Use Py_TPFLAGS_IMMUTABLETYPE iso. Py_TPFLAGS_HEAPTYPE in object_set_class(). See also: - bpo-43908 (particularly msg392286) - bpo-24912 - https://github.com/python/cpython/blob/e047239eafefe8b19725efffe7756443495cf78b/Objects/typeobject.c#L4620-L4668 -- messages: 392290 nosy: erlendaasland, gvanrossum, pitrou, vstinner priority: normal severity: normal status: open title: Use Py_TPFLAGS_IMMUTABLETYPE in __class__ assignments check ___ Python tracker <https://bugs.python.org/issue43973> ___ ___ 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
Erlend Egeberg Aasland added the comment: > Erlend: Do you want to write such change? Sure, I'll have a go at it. Thanks. -- ___ 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
Erlend Egeberg Aasland added the comment: Shreyan, see msg391954 earlier in this thread: "I also think you should try to separately land small patches that add the IMMUTABLETYPE flag to a few very public types, e.g. array.array and the three in _sre (which are exported by re.py)." -- ___ 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
Change by Erlend Egeberg Aasland : -- pull_requests: +24387 pull_request: https://github.com/python/cpython/pull/25697 ___ 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
Change by Erlend Egeberg Aasland : -- pull_requests: +24386 pull_request: https://github.com/python/cpython/pull/25696 ___ 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
Erlend Egeberg Aasland added the comment: See msg391933, Shreyan. I think Christian will take care of his types :) -- ___ 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
[issue43851] Optimise SQLite builds on macOS and Windows
Erlend Egeberg Aasland added the comment: Oh, well, SQLITE_DEFAULT_MEMSTATUS=0 does in fact affect PRAGMA soft_heap_limit. Looks like I'm left with only SQLITE_OMIT_AUTOINIT, then :) -- ___ Python tracker <https://bugs.python.org/issue43851> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43851] Optimise SQLite builds on macOS and Windows
Erlend Egeberg Aasland added the comment: Here's a list of the SQLite recommended compile-time options (only): - macOS (v11.2.3) (SQLite v3.32.3) defines SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 - Homebrew (SQLite v3.35.4) does not define any of the recommended compile-time options - Debian Buster (SQLite v3.27.2) defines SQLITE_LIKE_DOESNT_MATCH_BLOBS - Ubuntu 20.04 (SQLite v3.31.1) defines SQLITE_LIKE_DOESNT_MATCH_BLOBS AFAICS, adding SQLITE_DEFAULT_MEMSTATUS=0 and SQLITE_OMIT_AUTOINIT is safe, as it only affects the C API that we use, and nothing else. -- ___ Python tracker <https://bugs.python.org/issue43851> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43851] Optimise SQLite builds on macOS and Windows
Erlend Egeberg Aasland added the comment: As noted in https://github.com/python/cpython/pull/25414#issuecomment-828501078, SQLITE_OMIT_DEPRECATED also leaves out PRAGMA's, which can break applications. I'll update the PR's to leave it out. -- ___ Python tracker <https://bugs.python.org/issue43851> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43851] Optimise SQLite builds on macOS and Windows
Erlend Egeberg Aasland added the comment: I suggest applying the following safe options for the installers: # SQLITE_DEFAULT_MEMSTATUS Memory status is currently not available in the sqlite3 API, so there's no need for SQLite to keep track of this. If we add such an API (not likely, IMO), we can just remove this compile time option. See also bpo-35056. # SQLITE_OMIT_DEPRECATED No deprecated API functions are used by the sqlite3 module. # SQLITE_OMIT_AUTOINIT The sqlite3 module explicitly initialises SQLite; we can safely apply this option. I'll update the PR's. Berker, do you have any opinion about this? -- ___ Python tracker <https://bugs.python.org/issue43851> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Thanks, Serhiy. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43492] Upgrade to SQLite 3.35.5 in macOS and Windows
Change by Erlend Egeberg Aasland : -- pull_requests: +24355 pull_request: https://github.com/python/cpython/pull/25666 ___ Python tracker <https://bugs.python.org/issue43492> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43492] Upgrade to SQLite 3.35.5 in macOS and Windows
Change by Erlend Egeberg Aasland : -- pull_requests: +24354 pull_request: https://github.com/python/cpython/pull/25665 ___ Python tracker <https://bugs.python.org/issue43492> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43955] Test Failures on Windows 10
Change by Erlend Egeberg Aasland : -- nosy: -erlendaasland ___ Python tracker <https://bugs.python.org/issue43955> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43492] Upgrade to SQLite 3.35.5 in macOS and Windows
Erlend Egeberg Aasland added the comment: Thank you, Steve! -- ___ Python tracker <https://bugs.python.org/issue43492> ___ ___ 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
Erlend Egeberg Aasland added the comment: > I've not seen any failing tests for GH-25653 on the CI or on my computer. That would be GH-25520. GH-25653 is the slightly related issue/PR. Both are passing CI, though. -- ___ 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
Erlend Egeberg Aasland added the comment: > Are you two collaborating? No, but any help is of course appreciated. -- ___ 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
Erlend Egeberg Aasland added the comment: Shreyan, are you running the tests against the PR, or something else? Have you tried make clean (or git clean -fdx)? -- ___ 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
Erlend Egeberg Aasland added the comment: I've not seen any failing tests for GH-25653 on the CI or on my computer. The PR is based off of 1b1f9852bda85c01ef124858f293e9c13e04ffce, which is pretty recent. I can rebase onto master, but I don't see any need for it as long as the tests suite passes and there's no conflicts. -- ___ 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
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: > The second most important part here is also adding regression tests so this > doesn't happen. I've started adding tests. I'm not sure if I need to wrap them with @cpython_only. Some of the types are hidden deep inside the implementations, and I have a hard time fetching them. For example _functools._lru_list_elem and _thread._localdummy. Is it ok to leave those out? -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: For that to work, you'd have to add a flag in PyType_FromModuleAndSpec, set the flag if (slot->slot == Py_tp_new && slot->pfunc == NULL) in the slots for loop, and then reset tp_new _after_ PyType_Ready. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: > Alternatively we can make PyType_FromSpec() setting tp_new to NULL if there > is explicit {Py_tp_new, NULL} in slots. Yes. It's not as explicit (and self-documenting) as _PyType_DisabledNew, though. But it avoids expanding the C API. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Alternative approach: Add _PyType_DisabledNew to Include/cpython, and add {Py_tp_new, _PyType_DisabledNew} slot to affected types. Diff attached. See GH discussion: - https://github.com/python/cpython/pull/25653#issuecomment-827383246 - https://github.com/python/cpython/pull/25653#issuecomment-827390034 -- Added file: https://bugs.python.org/file49992/disablednew.diff ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: > These tests should also be added when new types are converted in the future. We should have a checklist for static to heap type conversion. I'm pretty sure I've seen something like that in one of Victor's blogs. A new section in the Dev Guide, maybe? -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Change by Erlend Egeberg Aasland : -- pull_requests: +24344 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25653 ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43492] Upgrade to SQLite 3.35.5 in macOS and Windows
Erlend Egeberg Aasland added the comment: Thanks Shreyan, but Steve prefers to update it himself: https://github.com/python/cpython-source-deps/pull/22#issuecomment-705234459 Just having the sources in place does not really help; you need a new git tag, which can only be pushed by core devs. Better to wait for the Windows team to fix this (also less noise for them) :) -- ___ Python tracker <https://bugs.python.org/issue43492> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43492] Upgrade to SQLite 3.35.5 in macOS and Windows
Erlend Egeberg Aasland added the comment: Steve & Ned: It would be nice if we could merge the PR's just before the weekend, so we get up-to-date installers for the beta. FYI, the SQLite forum has been quiet, and the fossil branch has not moved. -- ___ Python tracker <https://bugs.python.org/issue43492> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43492] Upgrade to SQLite 3.35.5 in macOS and Windows
Change by Erlend Egeberg Aasland : -- pull_requests: +24334 pull_request: https://github.com/python/cpython/pull/25641 ___ Python tracker <https://bugs.python.org/issue43492> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43492] Upgrade to SQLite 3.35.5 in macOS and Windows
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +24333 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25640 ___ Python tracker <https://bugs.python.org/issue43492> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Change by Erlend Egeberg Aasland : -- keywords: +patch Added file: https://bugs.python.org/file49989/patch.diff ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Pablo, I've made a patch for most of these (I've left out Christian's modules). I've only added a couple of tests for now. Do you want all in one PR? $ git diff main --stat Lib/test/test_array.py | 4 Lib/test/test_unicodedata.py | 4 Modules/_dbmmodule.c | 1 + Modules/_functoolsmodule.c | 2 ++ Modules/_gdbmmodule.c | 1 + Modules/_sre.c | 5 + Modules/_threadmodule.c| 2 ++ Modules/_winapi.c | 1 + Modules/arraymodule.c | 1 + Modules/cjkcodecs/multibytecodec.c | 1 + Modules/posixmodule.c | 2 ++ Modules/pyexpat.c | 1 + Modules/unicodedata.c | 1 + Modules/zlibmodule.c | 2 ++ 14 files changed, 28 insertions(+) I don't know why I included the sqlite3 and select types in msg391924; they are not affected by this issue. Somebody should double check that everything's covered. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Christian: > Can I get rid of the function with "{Py_tp_new, NULL}" [...] Unfortunately not. The workaround in 993e88cf08994f7c1e0f9f62fda4ed32634ee2ad does the trick though. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43762] Add audit events for loading of sqlite3 extensions
Erlend Egeberg Aasland added the comment: Ah, yes thanks for the heads up! I'll update the PR. -- ___ Python tracker <https://bugs.python.org/issue43762> ___ ___ 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
Erlend Egeberg Aasland added the comment: No problem, will do! -- ___ 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
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: You're right, that would become messy. Complementing existing test suites is a better approach. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ 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
Erlend Egeberg Aasland added the comment: > Could you please land the new flag and typeobject.c code now? I've only got two more questions before I mark it ready for review, and that's regarding Guido's comment in msg391756: Should the new flag also take care of __class__ assignment, or should we leave that out? Are there other places where !Py_TPFLAGS_HEAPTYPE is used where we would like to use the immutable flag? > I'm happy to take care of "my" code myself. No problem, I'll leave it out of the patch :) -- ___ 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
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Is it worth it adding tests for this? I'm thinking a generic version of msg391910 (maybe Lib/test/test_uninitialised_heap_types.py) coupled with a dataset. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Is there any way we can fix this in Objects/typeobject.c, or do we actually have to patch every single type manually? -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: Here's a plaintext version: - 0b858cdd5d2021-01-04 Modules/cjkcodecs/multibytecodec.c - _multibytecodec.MultibyteCodec - c8a87addb1 2021-01-04 Modules/pyexpat.c - pyexpat.xmlparser - 75bf107c62 2021-01-02 Modules/arraymodule.c - array.arrayiterator - dd39123970 2020-12-29 Modules/_functoolsmodule.c - functools.KeyWrapper - functools._lru_list_elem - 6104013838 2020-12-18 Modules/_threadmodule.c - _thread.lock - _thread._localdummy - a6109ef68d 2020-11-20 Modules/_sre.c - re.Pattern - re.Match - _sre.SRE_Scanner - c8c4200b65 2020-10-26 Modules/unicodedata.c - unicodedata.UCD - 256e54acdb 2020-10-01 Modules/_sqlite - sqlite3.Connection - sqlite3.Cursor - 9031bd4fa4 2020-10-01 Modules/_sqlite - sqlite3.Row - sqlite3.Statement - cb6db8b6ae 2020-09-27 Modules/_sqlite - sqlite3.Node - sqlite3.Cache - 52a2df135c 2020-09-08 Modules/sha256module.c - _sha256.sha224 - _sha256.sha256 - 2aabc3200b 2020-09-06 Modules/md5module.c Modules/sha1module.c Modules/sha512module.c - _md5.md5 - _sha1.sha1 - _sha512.sha384 - _sha512.sha512 - e087f7cd43 2020-08-13 Modules/_winapi.c - winapi__overlapped.Overlapped - c4862e333a 2020-06-17 Modules/_gdbmmodule.c - g_dbm.dbm - bf69a8f99f 2020-06-16 Modules/_dbmmodule.c - _dbm.dbm - 33f15a16d4 2019-11-05 Modules/posixmodule.c - posix.DirEntry - posix.ScandirIterator - df69e75edc 2019-09-25 Modules/_hashopenssl.c - _hashlib.HASH - f919054e53 2019-09-14 Modules/selectmodule.c - select.devpoll - select.kevent - select.poll - 04f0bbfbed 2019-09-10 Modules/zlibmodule.c - zlib.Compress - zlib.Decompress - 4f384af067 2012-10-14 Modules/_tkinter.c - _tkinter.Tcl_Obj - _tkinter.tktimertoken - _tkinter.tkapp - bc07cb883e 2012-06-14 Modules/_curses_panel.c - _curses_panel.panel -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ 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
Erlend Egeberg Aasland added the comment: > Can you provide the error output log you're getting? I don't think we should use more time on apply-to-all.diff, since it's probably not going to be applied as it is anyway. -- ___ 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
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: > Thank you for your work Erlend. Anytime! I've updated the list now. There may still be errors, but I think it's pretty accurate now. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: > It is incomplete. Yes, I know. I'm working on completing it manually. Some of the static structs were only partially initialised (most stop at tp_members). The rest of the struct (including tp_new) would then be initialised to zero. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Erlend Egeberg Aasland added the comment: > We need to check which static types had tp_new = NULL before they were > converted to heap types I did a quick git grep. Results pasted into the list over at https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403. -- ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43916] Check that new heap types cannot be created uninitialised
Change by Erlend Egeberg Aasland : -- nosy: +erlendaasland ___ Python tracker <https://bugs.python.org/issue43916> ___ ___ 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
Erlend Egeberg Aasland added the comment: > Let's post the list here and post a brief mention of this issue on python-dev. Attached. The list contains commits, commit dates, affected files, and the name of the PyType_Spec variables (I _can_ resolve these to the actual type names, but I figured this would be ok for now). I've also posted the list on Discsourse bco. readability. I'll post a notification on python-dev as well. https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403 -- Added file: https://bugs.python.org/file49987/list.txt ___ 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
Erlend Egeberg Aasland added the comment: Thanks for the background info, Guido! I'll prepare a list. Should we continue the discussion on Discourse or python-dev? -- ___ 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
Erlend Egeberg Aasland added the comment: The more I read about these issues, the more I feel reluctant to apply PR 25520. Why change the behaviour/traits of heap types without a proper discussion (or PEP)? Applying this PR feels like an arbitrary change. All the related issues and mailing list discussions seems to end without consensus, and fundamental questions (what is an immutable type? which types should be immutable? why is it a problem that a type is mutable?) seems to be avoided all the time. And, as Victor points out in msg391596 (and which has also been pointed out by others in other discussions): > Currently, the limitation of not being able to modify a built-in type is > arbitrary, it's not a technical limitation FWIW #1, in pypy3, datetime.timedelta.foo = 1 is ok; in python3 (3.7-3.10) it's not. FWIW #2, in Python 3.9, functools.partialmethod is implemented in Python, and functools.partial is implemented in C as a static type: $ python3.9 >>> import functools >>> functools.partial.foo = 1 # is this a problem? Traceback (most recent call last): File "", line 1, in TypeError: can't set attributes of built-in/extension type 'functools.partial' >>> functools.partialmethod.foo = 1 # is this a problem? If I'm only bringing noise into the discussion, feel free to remove me from the nosy list. -- ___ 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
[issue43762] Add audit events for loading of sqlite3 extensions
Erlend Egeberg Aasland added the comment: Maybe it's better to send the event only if the connection succeeded: diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 8dbfa7b38a..0220978cf2 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -97,6 +97,12 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject* result = PyObject_Call(factory, args, kwargs); +if (result) { +if (PySys_Audit("sqlite3.connected", "O", self) < 0) { +return -1; +} +} + return result; } -- ___ Python tracker <https://bugs.python.org/issue43762> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43762] Add audit events for loading of sqlite3 extensions
Erlend Egeberg Aasland added the comment: Something like the attached patch, if I understand you correctly? -- Added file: https://bugs.python.org/file49982/patch.diff ___ Python tracker <https://bugs.python.org/issue43762> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43762] Add audit events for loading of sqlite3 extensions
Erlend Egeberg Aasland added the comment: Good question. sqlite3_load_extension() loads an extension into a database connection, so it would make sense to also pass the connection object. I'd say we do it; it's a small change, and as you say: if we wanted to add it later, we couldn't. Ref. - http://www.sqlite.org/c3ref/load_extension.html -- ___ Python tracker <https://bugs.python.org/issue43762> ___ ___ 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
Erlend Egeberg Aasland added the comment: > Does the test suite pass for apply-to-all.diff? No, multiple tests fail. First test_distutils fails, then during the re-run, test_multiprocessing_forkserver, test_multiprocessing_spawn, and test_pdb fail. > Also, quite a hornet's nest you've uncovered (about __class__ assignment). Yes, indeed. Apropos, I see that bpo-24991 is still open. > Would that be fixed better with the IMMUTABLE flag? That would be a change of functionality, given that we apply the immutable flag to all built-in types. Currently __class__ assignment is allowed for heap types, and it has been so for many years. I feel reluctant to add apply-to-all.diff to the PR right now. -- ___ 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
Change by Erlend Egeberg Aasland : Removed file: https://bugs.python.org/file49979/apply-to-all.diff ___ 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
Change by Erlend Egeberg Aasland : Added file: https://bugs.python.org/file49980/apply-to-all.diff ___ 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
Erlend Egeberg Aasland added the comment: I've prepared a diff using grep & sed (see attached patch). Let me know if you want it converted to a PR. I've excluded the test and the _xx extension modules. -- Added file: https://bugs.python.org/file49979/apply-to-all.diff ___ 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