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

2022-01-26 Thread STINNER Victor


STINNER Victor  added the comment:

In Python 3.11, 68 heap types have the Py_TPFLAGS_IMMUTABLETYPE flag:

* _blake2.blake2b
* _blake2.blake2s
* _bz2.BZ2Compressor
* _bz2.BZ2Decompressor
* _csv.Dialect
* _csv.reader
* _csv.writer
* _dbm.dbm
* _gdbm.gdbm
* _hashlib.HASH
* _hashlib.HASHXOF
* _hashlib.HMAC
* _lsprof.Profiler
* _lzma.LZMACompressor
* _lzma.LZMADecompressor
* _md5.md5
* _multibytecodec.MultibyteCodec
* _multibytecodec.MultibyteIncrementalDecoder
* _multibytecodec.MultibyteIncrementalEncoder
* _multibytecodec.MultibyteStreamReader
* _multibytecodec.MultibyteStreamWriter
* _overlapped.Overlapped
* _queue.SimpleQueue
* _sha1.sha1
* _sha256.sha224
* _sha256.sha256
* _sha3.keccak_224
* _sha3.keccak_256
* _sha3.keccak_384
* _sha3.keccak_512
* _sha3.sha3_224
* _sha3.sha3_256
* _sha3.sha3_384
* _sha3.sha3_512
* _sha512.sha384
* _sha512.sha512
* _sre.SRE_Scanner
* _ssl.Certificate
* _ssl.MemoryBIO
* _ssl.SSLSession
* _ssl._SSLContext
* _ssl._SSLSocket
* ssl.SSLError
* _thread.RLock
* _thread._local
* _thread._localdummy
* _thread.lock
* _tokenize.TokenizerIter
* _winapi.Overlapped
* array.array
* array.arrayiterator
* functools.KeyWrapper
* functools._lru_cache_wrapper
* functools._lru_list_elem
* functools.partial
* mmap.mmap
* operator.attrgetter
* operator.itemgetter
* operator.methodcaller
* pyexpat.xmlparser
* re.Match
* re.Pattern
* sqlite3.Connection
* sqlite3.Cursor
* sqlite3.PrepareProtocol
* sqlite3.Row
* sqlite3.Statement
* unicodedata.UCD

--

___
Python tracker 

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

2022-01-26 Thread STINNER Victor


STINNER Victor  added the comment:

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

I don't think that Python 3.9 should be changed. It's too late. IMO this issue 
is not important enough to introduce a new type flag in a minor Python 3.9.x 
bugfix release. I suggest to close this issue.

--

___
Python tracker 

___
___
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-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Yeah, I think these should be changed, but lest give a bit of time for other 
core devs to mention what they think

--

___
Python tracker 

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

___
___
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 Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I would say yes. Do you have a compiled list of what's left?

--

___
Python tracker 

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

___
___
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 Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: release blocker -> 

___
Python tracker 

___
___
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 Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Is anything left here?

--

___
Python tracker 

___
___
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 STINNER Victor


STINNER Victor  added the comment:


New changeset a3739b207adb5d17e3b53347df05b54b1a8b87f0 by Erlend Egeberg 
Aasland in branch 'main':
bpo-43908: Immutable types inherit vectorcall (GH-27001)
https://github.com/python/cpython/commit/a3739b207adb5d17e3b53347df05b54b1a8b87f0


--

___
Python tracker 

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

___
___
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 Guido van Rossum


Guido van Rossum  added the comment:

+1--
--Guido (mobile)

--

___
Python tracker 

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

___
___
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-17 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 7297d74251de3b1c02dcdb9ca281461cc7fb4535 by Miss Islington (bot) 
in branch '3.10':
bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351) 
(GH-26766)
https://github.com/python/cpython/commit/7297d74251de3b1c02dcdb9ca281461cc7fb4535


--

___
Python tracker 

___
___
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-17 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 00710e6346fd2394aa020b2dfae170093effac98 by Erlend Egeberg 
Aasland in branch 'main':
bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351)
https://github.com/python/cpython/commit/00710e6346fd2394aa020b2dfae170093effac98


--

___
Python tracker 

___
___
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-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25352
pull_request: https://github.com/python/cpython/pull/26766

___
Python tracker 

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

___
___
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-04 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: deferred blocker -> release blocker

___
Python tracker 

___
___
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-05-25 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +24941
pull_request: https://github.com/python/cpython/pull/26351

___
Python tracker 

___
___
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-05-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Notice this issue is marked as "deferred blocker" it won't block this beta 
release (beta 2) but it will block the next.

--

___
Python tracker 

___
___
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-05-25 Thread STINNER Victor

STINNER Victor  added the comment:

Guido: "I don’t think we’re waiting for more crazy hacks."

Right now, _ast.AST is still mutable:

$ ./python
Python 3.11.0a0 (heads/subtype_dealloc-dirty:efd45ad788, May 21 2021
>>> import _ast
>>> _ast.AST.x=1
>>> _ast.AST.x
1

--

___
Python tracker 

___
___
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-05-25 Thread STINNER Victor


STINNER Victor  added the comment:

main branch:

commit a09fc9c63f1b5980c62ff2712f67500bacb92b04
Author: Erlend Egeberg Aasland 
Date:   Fri May 14 00:44:55 2021 +0200

bpo-43908: Add What's New entry for Py_TPFLAGS_IMMUTABLETYPE flag (GH-25816)

--

___
Python tracker 

___
___
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-05-13 Thread miss-islington


miss-islington  added the comment:


New changeset 3222b25b2f55d3b3d1dab4547bf7b5adaa1d874f by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-43908: Add What's New entry for Py_TPFLAGS_IMMUTABLETYPE flag 
(GH-25816) (GH-26115)
https://github.com/python/cpython/commit/3222b25b2f55d3b3d1dab4547bf7b5adaa1d874f


--

___
Python tracker 

___
___
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-05-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 11.0 -> 12.0
pull_requests: +24760
pull_request: https://github.com/python/cpython/pull/26115

___
Python tracker 

___
___
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-05-02 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24502
pull_request: https://github.com/python/cpython/pull/25816

___
Python tracker 

___
___
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-05-02 Thread Erlend Egeberg Aasland


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 

___
___
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-05-02 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Should I apply the flags on other newly converted heap types?

--

___
Python tracker 

___
___
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-05-02 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 91554e4c5ca3c762998296522f854a7166ba84f0 by Christian Heimes in 
branch 'master':
bpo-43908: Mark ssl, hash, and hmac types as immutable (GH-25792)
https://github.com/python/cpython/commit/91554e4c5ca3c762998296522f854a7166ba84f0


--

___
Python tracker 

___
___
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-05-01 Thread Christian Heimes


Christian Heimes  added the comment:

What's the plan for heap type exceptions? PyErr_NewException() and 
PyErr_NewExceptionWithDoc() doesn't accept flags.

--

___
Python tracker 

___
___
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-05-01 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +24482
pull_request: https://github.com/python/cpython/pull/25792

___
Python tracker 

___
___
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-04-30 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am decreasing the priority of this to deferred blocker since 
https://bugs.python.org/issue43916 is mostly fixed

--
priority: release blocker -> deferred blocker

___
Python tracker 

___
___
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-04-30 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Ok

--

___
Python tracker 

___
___
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-04-30 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Ok

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

> Victor, the types, that Py_TPFLAGS_IMMUTABLETYPE flag is yet to be applied 
> to, are different for 3.9 and 3.10. Should we proceed with that? (If yes I'd 
> be happy to collaborate with Erlend to apply the flag on those types.)

Please don't change the behavior in the 3.9 stable branch.

--

___
Python tracker 

___
___
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-04-30 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Victor, the types, that Py_TPFLAGS_IMMUTABLETYPE flag is yet to be applied to, 
are different for 3.9 and 3.10. Should we proceed with that? (If yes I'd be 
happy to collaborate with Erlend to apply the flag on those types.)

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

Moreover, all static types get the Py_TPFLAGS_IMMUTABLETYPE flag automatically. 
For example, "./python -c pass" initializes 196 immutable static types:

* ArithmeticError
* AssertionError
* AttributeError
* BaseException
* BlockingIOError
* BrokenPipeError
* BufferError
* BytesWarning
* ChildProcessError
* ConnectionAbortedError
* ConnectionError
* ConnectionRefusedError
* ConnectionResetError
* DeprecationWarning
* EOFError
* EncodingMap
* EncodingWarning
* Exception
* FileExistsError
* FileNotFoundError
* FloatingPointError
* FutureWarning
* GeneratorExit
* ImportError
* ImportWarning
* IndentationError
* IndexError
* InterpreterID
* InterruptedError
* IsADirectoryError
* KeyError
* KeyboardInterrupt
* LookupError
* MemoryError
* ModuleNotFoundError
* NameError
* NoneType
* NotADirectoryError
* NotImplementedError
* NotImplementedType
* OSError
* OverflowError
* PendingDeprecationWarning
* PermissionError
* ProcessLookupError
* PyCapsule
* RecursionError
* ReferenceError
* ResourceWarning
* RuntimeError
* RuntimeWarning
* StopAsyncIteration
* StopIteration
* SyntaxError
* SyntaxWarning
* SystemError
* SystemExit
* TabError
* TimeoutError
* Token.MISSING
* TypeError
* UnboundLocalError
* UnicodeDecodeError
* UnicodeEncodeError
* UnicodeError
* UnicodeTranslateError
* UnicodeWarning
* UnraisableHookArgs
* UserWarning
* ValueError
* Warning
* ZeroDivisionError
* _contextvars.Context
* _contextvars.ContextVar
* _contextvars.Token
* _io.BufferedRWPair
* _io.BufferedRandom
* _io.BufferedReader
* _io.BufferedWriter
* _io.BytesIO
* _io.FileIO
* _io.IncrementalNewlineDecoder
* _io.StringIO
* _io.TextIOWrapper
* _io._BufferedIOBase
* _io._BytesIOBuffer
* _io._IOBase
* _io._RawIOBase
* _io._TextIOBase
* _thread._ExceptHookArgs
* anext_awaitable
* async_generator
* async_generator_asend
* async_generator_athrow
* async_generator_wrapped_value
* asyncgen_hooks
* bool
* builtin_function_or_method
* builtin_method
* bytearray
* bytearray_iterator
* bytes
* bytes_iterator
* callable_iterator
* cell
* classmethod
* classmethod_descriptor
* code
* collections.OrderedDict
* complex
* coroutine
* coroutine_wrapper
* dict
* dict_itemiterator
* dict_items
* dict_keyiterator
* dict_keys
* dict_reverseitemiterator
* dict_reversekeyiterator
* dict_reversevalueiterator
* dict_valueiterator
* dict_values
* ellipsis
* enumerate
* fieldnameiterator
* filter
* float
* formatteriterator
* frame
* frozenset
* function
* generator
* getset_descriptor
* hamt
* hamt_array_node
* hamt_bitmap_node
* hamt_collision_node
* instancemethod
* int
* items
* iterator
* keys
* list
* list_iterator
* list_reverseiterator
* longrange_iterator
* managedbuffer
* map
* mappingproxy
* member_descriptor
* memoryview
* method
* method-wrapper
* method_descriptor
* module
* moduledef
* object
* odict_items
* odict_iterator
* odict_keys
* odict_values
* pickle.PickleBuffer
* property
* range
* range_iterator
* reversed
* set
* set_iterator
* signal.struct_siginfo
* slice
* staticmethod
* stderrprinter
* str
* str_iterator
* super
* symtable entry
* sys.flags
* sys.float_info
* sys.hash_info
* sys.int_info
* sys.thread_info
* sys.version_info
* time.struct_time
* traceback
* tuple
* tuple_iterator
* type
* types.GenericAlias
* types.SimpleNamespace
* types.Union
* values
* weakcallableproxy
* weakproxy
* weakref
* wrapper_descriptor
* zip

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

Currently, 4 types are declared with Py_TPFLAGS_IMMUTABLETYPE explicitly:

* array.array
* re.Pattern
* re.Match
* _sre.SRE_Scanner

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 64141382ecbad665d5738ff26d15505f3427c724 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43908: check_set_special_type_attr() checks Py_TPFLAGS_IMMUTABLETYPE 
(GH-25743)
https://github.com/python/cpython/commit/64141382ecbad665d5738ff26d15505f3427c724


--

___
Python tracker 

___
___
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-04-30 Thread Erlend Egeberg Aasland

Erlend Egeberg Aasland  added the comment:

Yes, I’ll have a look at it this afternoon. (On mobile now.)

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

Erlend: would you mind to document the new Py_TPFLAGS_IMMUTABLETYPE flag in the 
C API section of What's New in Python 3.10?
https://docs.python.org/dev/whatsnew/3.10.html#c-api-changes

In "New Features", something like:

* Add a new :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag to (...).
  (Contributed by xxx in :issue:`43908`.)

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.

Maybe explain that Py_TPFLAGS_IMMUTABLETYPE should now be checked to decide if 
a type is mutable or not, rather than relying on Py_TPFLAGS_HEAPTYPE.

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

https://docs.python.org/dev/c-api/typeobj.html#Py_TPFLAGS_IMMUTABLETYPE says:
"This bit is set for type objects that are immutable: type attributes cannot be 
set nor deleted."

Is it possible that a metatype (type subtype) overrides tp_setattro and ignores 
the Py_TPFLAGS_IMMUTABLETYPE flag? Should we suggest that metatypes implemented 
in C and overridding tp_setattro should take the Py_TPFLAGS_IMMUTABLETYPE flag 
in account?

When a type overrides tp_setattro, I understand that it's fine since it's only 
used to set attributes of its instances, not on the type itself.

--

See also bpo-43770 "Rework C types initialization": some types explicitly sets 
explicitly tp_setattro to PyObject_GenericSetAttr. But it's unrelated since 
it's used to set attributes of type instances.

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

PyStdPrinter_Type implements tp_new, but tp_init always fail:

static int
stdprinter_init(PyObject *self, PyObject *args, PyObject *kwds)
{
PyErr_SetString(PyExc_TypeError,
"cannot create 'stderrprinter' instances");
return -1;
}

Maybe it should use the Py_TPFLAGS_IMMUTABLETYPE flag instead?

Instances must be created with PyFile_NewStdPrinter() which doesn't use tp_new 
nor tp_init.

Erlend: do you want to propose a PR?

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-24912 "The type of cached objects is mutable".

--

___
Python tracker 

___
___
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-04-30 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Included in GH-25743

--

___
Python tracker 

___
___
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-04-30 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I just found it myself :) pushing out the PR now!

--

___
Python tracker 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

Hum, another function should be updated. Do you want to propose a fix Erlend?

static int
type_set_annotations(PyTypeObject *type, PyObject *value, void *context)
{
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
PyErr_Format(PyExc_TypeError, "can't set attributes of 
built-in/extension type '%s'", type->tp_name);
return -1;
}

--

___
Python tracker 

___
___
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-04-30 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24433
pull_request: https://github.com/python/cpython/pull/25743

___
Python tracker 

___
___
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-04-30 Thread Erlend Egeberg Aasland


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 

___
___
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-04-30 Thread STINNER Victor


STINNER Victor  added the comment:

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

I don't know. In case of doubt, I suggest to only replace !Py_TPFLAGS_HEAPTYPE 
with Py_TPFLAGS_IMMUTABLETYPE.

--

___
Python tracker 

___
___
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-04-30 Thread Erlend Egeberg Aasland


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 

___
___
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-04-30 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Py_TPFLAGS_IMMUTABLETYPE has been applied to array.array by Erlend in 
https://github.com/python/cpython/pull/25696. Should Py_TPFLAGS_IMMUTABLETYPE 
be applied to other heap types also (the ones that were converted from static 
types)?

--

___
Python tracker 

___
___
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-04-29 Thread Guido van Rossum

Guido van Rossum  added the comment:

I don’t think we’re waiting for more crazy hacks.

On Thu, Apr 29, 2021 at 07:27 STINNER Victor  wrote:

>
> STINNER Victor  added the comment:
>
> >
> https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403
>
> In the past, I used _random.Random for manual tests to compare static type
> and heap types, check which one is mutable.
>
> C type _random.Random is inherited by Python type random.Random which is
> mutable. Since _random.Random is not directly seen by developers, I don't
> think that it's worth it to make it immutable.
>
> For the other types, I would not say that they are "built-in types" or
> that it would be really bad to modify them. I would say that for the other
> types, the "We are consenting adults" rule stands. You can hack a type for
> a very specific need, but in this case you are on your own.
>
> For example, people love to hack AST. Maybe the fact that ast.AST became
> mutable in Python 3.9 will unlock some crazy hack?
>
> --
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--
title: array.array and re types must be immutable: add Py_TPFLAGS_IMMUTABLETYPE 
flag -> array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

___
Python tracker 

___
___
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-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403

In the past, I used _random.Random for manual tests to compare static type and 
heap types, check which one is mutable.

C type _random.Random is inherited by Python type random.Random which is 
mutable. Since _random.Random is not directly seen by developers, I don't think 
that it's worth it to make it immutable.

For the other types, I would not say that they are "built-in types" or that it 
would be really bad to modify them. I would say that for the other types, the 
"We are consenting adults" rule stands. You can hack a type for a very specific 
need, but in this case you are on your own.

For example, people love to hack AST. Maybe the fact that ast.AST became 
mutable in Python 3.9 will unlock some crazy hack?

--

___
Python tracker 

___
___
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-04-29 Thread Erlend Egeberg Aasland


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 

___
___
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-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> Erlend: Do you want to write such change?

Erlend created bpo-43973 and PR 25714.

--

___
Python tracker 

___
___
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-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
title: array.array should remain immutable -> array.array should remain 
immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

___
Python tracker 

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

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

check_set_special_type_attr() must also be updated to check for 
Py_TPFLAGS_IMMUTABLETYPE flag.

--

___
Python tracker 

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

2021-04-29 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24404
pull_request: https://github.com/python/cpython/pull/25714

___
Python tracker 

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

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5bd0619533ed6587ce76402e9b0b118eb4d4dd09 by Victor Stinner in 
branch 'master':
bpo-43908: Document Static Types in the C API (GH-25710)
https://github.com/python/cpython/commit/5bd0619533ed6587ce76402e9b0b118eb4d4dd09


--

___
Python tracker 

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

2021-04-29 Thread Erlend Egeberg Aasland


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 

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

2021-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> BTW, slightly related, AFAICT:
> - 
> https://github.com/python/cpython/blob/e047239eafefe8b19725efffe7756443495cf78b/Objects/typeobject.c#L4620-L4668
> - bpo-24912

object_set_class() must be changed to check for Py_TPFLAGS_IMMUTABLETYPE flag, 
rather than Py_TPFLAGS_HEAPTYPE.

Erlend: Do you want to write such change?

--

___
Python tracker 

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

2021-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24399
pull_request: https://github.com/python/cpython/pull/25710

___
Python tracker 

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

2021-04-29 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

The types converted to heap types in 3.10 are different from 3.9 therefore just 
backporting wouldn't help. Should we now try to apply the flags on other types? 
If yes then I'd like to volunteer to apply the flags on the types converted in 
3.9.

--

___
Python tracker 

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

2021-04-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c6ad03fddf4b04c60dca4327140e59fb2dcca8e5 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43908: Make array.array type immutable (GH-25696)
https://github.com/python/cpython/commit/c6ad03fddf4b04c60dca4327140e59fb2dcca8e5


--

___
Python tracker 

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

2021-04-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5daf70b22e72ea1a88c05975f69120b8c4e4927f by Erlend Egeberg 
Aasland in branch 'master':
bpo-43908: Make re types immutable (GH-25697)
https://github.com/python/cpython/commit/5daf70b22e72ea1a88c05975f69120b8c4e4927f


--

___
Python tracker 

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

2021-04-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

In any case, that's my personal opinion of course.

What we should do is decide collectively if immutability is defined behaviour. 
If we decide that it is, we need regression tests. If we define that as "nice 
to have" but ultimately "implementation-defined" we don't.

In any case, I would argue that having tests is good and allow us to know when 
the behaviour flips without people intending it to, like what happened in this 
case.

--

___
Python tracker 

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

2021-04-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Immutability of the type is mainly an implementation detail

I kindly disagree and based on the title of this issue I think more people have 
a similar opinion.

--

___
Python tracker 

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

2021-04-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not sure tests are needed here. Immutability of the type is mainly an 
implementation detail. We keep the types immutable because we don't want users 
to use the feature of mutating these types. I don't think anything bad will 
happen if in some Python implementation some of these types are Python classes 
and are mutable. It is not easy to make a Python class immutable. Users will 
not intentionally write a code depending on mutability of these types because 
it does not work in CPython.

--

___
Python tracker 

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

2021-04-28 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

ok.

--

___
Python tracker 

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

2021-04-28 Thread Erlend Egeberg Aasland


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 

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

2021-04-28 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Erlend, wouldn't it be easy to apply all the changes in 1 PR?

--

___
Python tracker 

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

2021-04-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> We don't have immutability tests for static types then why heap types?

Because all static types are immutable, and some have been converted to heap 
types changing the contract, therefore is a regression and therefore we need 
regression tests for those.

--

___
Python tracker 

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

2021-04-28 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Is it necessary to add tests just for testing type immutability? We don't have 
immutability tests for static types then why heap types?

--

___
Python tracker 

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

2021-04-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24387
pull_request: https://github.com/python/cpython/pull/25697

___
Python tracker 

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

2021-04-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24386
pull_request: https://github.com/python/cpython/pull/25696

___
Python tracker 

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

2021-04-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3b52c8d66b25415f09478ab43f93d59a3547dc13 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43908: Add Py_TPFLAGS_IMMUTABLETYPE flag (GH-25520)
https://github.com/python/cpython/commit/3b52c8d66b25415f09478ab43f93d59a3547dc13


--

___
Python tracker 

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

2021-04-28 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

See msg391933, Shreyan. I think Christian will take care of his types :)

--

___
Python tracker 

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

2021-04-28 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Was EVPtype_spec in _hashopenssl.c converted to heap type?

--

___
Python tracker 

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

2021-04-27 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

See issue https://bugs.python.org/issue43955 for the test failures.

--

___
Python tracker 

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

2021-04-27 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Since, these changes and the test failures are not related to each other at 
all, I'm opening a new issue addressing the test failures only. I'm adding 
everyone in this issue's nosy to the new issue's nosy as well.

--

___
Python tracker 

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

2021-04-27 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

There are no errors in apply-to-all.diff because I've ran the tests both with 
and without the changes and both give me the same output. It's safe to proceed 
with apply-to-all.diff. The only problem is why are the tests failing at all? I 
ran the tests a few days earlier on this machine only (Windows 10) and it was 
successful then.

--

___
Python tracker 

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

2021-04-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't think I've ever successfully managed to complete the test on my
Windows 10 box either (not even in "production" mode -- you seem to be
using debug mode). I recommend using creating a new PR and having the CI
machinery run the tests. It's more reliable that way.

--

___
Python tracker 

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

2021-04-27 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Re-running tests complete. I'm attaching the results. If the errors are not 
reproducible then please tell. I'll then rebuild and rerun the tests once more.

--
Added file: https://bugs.python.org/file49994/tests_log.txt

___
Python tracker 

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

2021-04-27 Thread Erlend Egeberg Aasland


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 

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

2021-04-27 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

> Shreyan, are you running the tests against the PR, or something else? Have 
> you tried make clean (or git clean -fdx)?

I always have a clean branch checked out but the last time I ran the tests it 
was unsuccessful. I'm re-running the tests now and hoping that the tests will 
be successful this time. However lot of tests have been fixed.

--

___
Python tracker 

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

2021-04-27 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> Are you two collaborating?

No, but any help is of course appreciated.

--

___
Python tracker 

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

2021-04-27 Thread Erlend Egeberg Aasland


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 

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

2021-04-27 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Let me re-run the test suite again and see if the tests have been fixed in the 
most recent commits.

--

___
Python tracker 

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

2021-04-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Pablo, there seems to be some instability in the tests.

Apart from the typical test_asyncio random timeouts I don't see anything on the 
buildbots or the CI. What are those failing test? Maybe I can try to reproduce 
on my side

--

___
Python tracker 

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

2021-04-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sure. What do you think is causing the failures for Shreyan then? (Are you
two collaborating?)
-- 
--Guido (mobile)

--

___
Python tracker 

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

2021-04-27 Thread Erlend Egeberg Aasland


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 

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

2021-04-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

Pablo, there seems to be some instability in the tests.

Shreyan, Erlend, maybe merging in master would help?

--
nosy: +Guido.van.Rossum

___
Python tracker 

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

2021-04-27 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Re-running the failed tests doesn't trigger the errors but running the whole 
test suite does. And some errors I described are fixed in any of the last 22 
commits and PRs. Therefore should we actually look into this matter or should 
we leave it as it is?

--

___
Python tracker 

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

2021-04-26 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

I ran the test suite without the changes and they still fail. Therefore 
apply-to-all.diff does not have any bug at all. But the test failures are also 
a major issue not only for this change but also for others. I'm opening a new 
issue for those test failures.

(apply-to-all.diff is outdated because Erlend changed the flag name from 
Py_TPFLAGS_IMMUTABLE to Py_TPFLAGS_IMMUTABLETYPE in the PR. I'm attaching the 
modified apply-to-all.diff)

--
Added file: https://bugs.python.org/file49990/apply-to-all.diff

___
Python tracker 

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

2021-04-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

So keep cutting in half until the error disappears?

--

___
Python tracker 

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

2021-04-26 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

> The solution would be bisection -- apply half of the changes from
apply-to-all, and see if you still get the errors. Etc.

Getting the same error. These are the errors :-

0:12:14 load avg: 0.92 [115/426] test_distutils
test test_distutils crashed -- Traceback (most recent call last):
  File "C:\github\cpython\lib\test\libregrtest\runtest.py", line 282, in 
_runtest_inner
refleak = _runtest_inner2(ns, test_name)
  File "C:\github\cpython\lib\test\libregrtest\runtest.py", line 229, in 
_runtest_inner2
the_module = importlib.import_module(abstest)
  File "C:\github\cpython\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1050, in _gcd_import
  File "", line 1027, in _find_and_load
  File "", line 1006, in _find_and_load_unlocked
  File "", line 688, in _load_unlocked
  File "", line 881, in exec_module
  File "", line 241, in _call_with_frames_removed
  File "C:\github\cpython\lib\test\test_distutils.py", line 15, in 
import distutils.tests
  File "C:\github\cpython\lib\contextlib.py", line 140, in __exit__
next(self.gen)
  File "C:\github\cpython\lib\test\support\warnings_helper.py", line 179, in 
_filterwarnings
raise AssertionError("filter (%r, %s) did not catch any warning" %
AssertionError: filter ('The distutils package is deprecated', 
DeprecationWarning) did not catch any warning



0:19:05 load avg: 0.07 [212/426/1] test_logging
--- Logging error ---
Traceback (most recent call last):
  File "C:\github\cpython\lib\logging\handlers.py", line 74, in emit
self.doRollover()
  File "C:\github\cpython\lib\logging\handlers.py", line 179, in doRollover
self.rotate(self.baseFilename, dfn)
  File "C:\github\cpython\lib\logging\handlers.py", line 117, in rotate
self.rotator(source, dest)
  File "C:\github\cpython\lib\test\test_logging.py", line 5222, in rotator
os.rename(source, dest + ".rotated")
FileExistsError: [WinError 183] Cannot create a file when that file already 
exists: 'C:\\Users\\shrey\\AppData\\Local\\Temp\\test_logging-2-lh2g0lpt.log' 
-> 
'C:\\Users\\shrey\\AppData\\Local\\Temp\\test_logging-2-lh2g0lpt.log.1.test.rotated'
Call stack:
  File "C:\github\cpython\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "C:\github\cpython\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
  File "C:\github\cpython\lib\test\__main__.py", line 2, in 
main()
  File "C:\github\cpython\lib\test\libregrtest\main.py", line 719, in main
Regrtest().main(tests=tests, **kwargs)
  File "C:\github\cpython\lib\test\libregrtest\main.py", line 641, in main
self._main(tests, kwargs)
  File "C:\github\cpython\lib\test\libregrtest\main.py", line 694, in _main
self.run_tests()
  File "C:\github\cpython\lib\test\libregrtest\main.py", line 521, in run_tests
self.run_tests_sequential()
  File "C:\github\cpython\lib\test\libregrtest\main.py", line 423, in 
run_tests_sequential
result = runtest(self.ns, test_name)
  File "C:\github\cpython\lib\test\libregrtest\runtest.py", line 194, in runtest
return _runtest(ns, test_name)
  File "C:\github\cpython\lib\test\libregrtest\runtest.py", line 154, in 
_runtest
result = _runtest_inner(ns, test_name,
  File "C:\github\cpython\lib\test\libregrtest\runtest.py", line 282, in 
_runtest_inner
refleak = _runtest_inner2(ns, test_name)
  File "C:\github\cpython\lib\test\libregrtest\runtest.py", line 246, in 
_runtest_inner2
test_runner()
  File "C:\github\cpython\lib\test\support\__init__.py", line 682, in inner
return func(*args, **kwds)
  File "C:\github\cpython\lib\test\test_logging.py", line 5503, in test_main
support.run_unittest(*tests)
  File "C:\github\cpython\lib\test\support\__init__.py", line 1082, in 
run_unittest
_run_suite(suite)
  File "C:\github\cpython\lib\test\support\__init__.py", line 959, in _run_suite
result = runner.run(suite)
  File "C:\github\cpython\lib\test\support\testresult.py", line 169, in run
test(self.result)
  File "C:\github\cpython\lib\unittest\suite.py", line 84, in __call__
return self.run(*args, **kwds)
  File "C:\github\cpython\lib\unittest\suite.py", line 122, in run
test(result)
  File "C:\github\cpython\lib\unittest\suite.py", line 84, in __call__
return self.run(*args, **kwds)
  File "C:\github\cpython\lib\unittest\suite.py", line 122, in run
test(result)
  File "C:\github\cpython\lib\unittest\case.py", line 652, in __call__
return self.run(*args, **kwds)
  File "C:\github\cpython\lib\unittest\case.py", line 592, in run
self._callTestMethod(testMethod)
  File "C:\github\cpython\lib\unittest\case.py", line 549, in _callTestMethod
method()
  File "C:\github\cpython\lib\test\test_logging.py", line 5229, in 
test_namer_rotator_inheritance
rh.emit(self.next_rec())


0:26:02 load avg: 0.46 [250/426/1] test_pdb
test test_pdb failed -- Traceback

[issue43908] array.array should remain immutable

2021-04-26 Thread Shreyan Avigyan


Change by Shreyan Avigyan :


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

___
Python tracker 

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

2021-04-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

The solution would be bisection -- apply half of the changes from
apply-to-all, and see if you still get the errors. Etc.

--

___
Python tracker 

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

2021-04-26 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

@serhiy.storchaka I have no idea what's causing the errors I described in 
https://bugs.python.org/msg391947. I looked at all the changes in 
apply-to-all.diff and I don't think any of the errors are related. Do you have 
any thoughts about this problem? Is it even reproducible?

(I'm attaching a diff combining the patch.diff and apply-to-all.diff together 
in one file.)

--
Added file: https://bugs.python.org/file49988/patch.diff

___
Python tracker 

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

2021-04-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

PS. Don't wait for me. I'm going on vacation this Thursday and won't be
back until well after the 3.10b1 release is done, and before I go I'm
pretty busy already.

--

___
Python tracker 

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

2021-04-26 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

No problem, will do!

--

___
Python tracker 

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



  1   2   >