[issue11455] issue a warning when populating a CPython type dict with non-string keys

2021-12-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Why not raise an error if it contradicts language spec? -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2021-12-01 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11. >>> A = type("A", (object,), {42: "abc"}) >>> dir(A()) Traceback (most recent call last): File "", line 1, in TypeError: '<' not supported between instances of 'int' and 'str' -- nosy: +iritkatriel type: behavior -> enhancement

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2019-04-27 Thread Mark Lawrence
Change by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2014-07-11 Thread Mark Lawrence
Mark Lawrence added the comment: The patch is short and sweet. Assuming it is acceptable do we commit or don't we? See also the reference to #11470 in msg132032. -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-05-20 Thread Brian Curtin
Changes by Brian Curtin br...@python.org: -- nosy: +brian.curtin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11455 ___ ___ Python-bugs-list

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-24 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: Thomas, I know you've been working on this post-Pycon. Could you please take a look at Daniel's patch and/or publish your own. -- assignee: - twouters nosy: +ncoghlan, twouters ___ Python tracker

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-24 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11455 ___ ___

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-24 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Cool, someone uses my PyErr_WarnFormat() function! :-) I didn't know that NULL can be used for the category: I would prefer an explicit PyExc_RuntimeWarning to not have to read the source of PyErr_WarnFormat() or its documentation.

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-24 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: I would prefer an explicit PyExc_RuntimeWarning to not have to read the source of PyErr_WarnFormat() or its documentation. The patch at issue11470 adds a new warning type, CompatibilityWarning. I think probably that should be used here

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-10 Thread Daniel Stutzbach
Daniel Stutzbach stutzb...@google.com added the comment: For what it's worth, I believe this could be implemented easily by calling _PyDict_HasOnlyStringKeys at the end of the class creation process. -- nosy: +stutzbach ___ Python tracker

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-10 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Can somebody propose a patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11455 ___ ___

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-10 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: Can somebody propose a patch? Yes, here it is. (I'm not sure if the test is in the correct file.) -- keywords: +patch nosy: +durban Added file: http://bugs.python.org/file21072/issue11455.patch

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-10 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: How about the case where non-string keys are added after the class is created? (I think I've heard some third-party lib does this, perhaps a generic functions implementation?) -- nosy: +pitrou ___

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-10 Thread Alex
Alex alex.gay...@gmail.com added the comment: How can they be set afterwords? alex@alex-laptop:~/projects/pypy$ python3.1 Python 3.1.2 (release31-maint, Sep 17 2010, 20:34:23) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. class A(object): ... pass

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-10 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Hmm, that's true (although there's a trick using gc.get_referers(), IIRC). I was probably thinking about instance dicts rather than type dicts, then. -- ___ Python tracker rep...@bugs.python.org

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-09 Thread Michael Foord
New submission from Michael Foord mich...@voidspace.org.uk: It is valid in CPython to create a new type with non-string keys in the dict. This is a problem for other implementations (neither pypy nor jython support it). This should raise a warning. -- components: Interpreter Core

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-09 Thread Alex
Alex alex.gay...@gmail.com added the comment: 2 ways to do it: class A(object): locals()[42] = abc or type(A, (object,), {42: abc}) -- nosy: +alex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11455

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-09 Thread Michael Foord
Michael Foord mich...@voidspace.org.uk added the comment: Note that other implementations not supporting this has been agreed by Guido. The language spec says that the class dict is a namespace and should have string keys. -- ___ Python tracker

[issue11455] issue a warning when populating a CPython type dict with non-string keys

2011-03-09 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: I fail to see the need to warn about this, though. Users using the feature are likely aware that this violates the language specification, and will find out quickly when they do port it to another Python implementation. There are many many