[issue5945] PyMapping_Check returns 1 for lists

2018-06-04 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue5945] PyMapping_Check returns 1 for lists

2018-06-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Are these changes enough? Can this issue be closed now? -- ___ Python tracker ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2018-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 93e9fb5664e56c02c9aa89098b556929735b35db by Serhiy Storchaka in branch '3.6': [3.6] bpo-5945: Improve mappings and sequences C API docs. (GH-7029). (GH-7049)

[issue5945] PyMapping_Check returns 1 for lists

2018-05-22 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +6686 ___ Python tracker ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2018-05-22 Thread miss-islington
miss-islington added the comment: New changeset e1a78cacf65f007b1000966ce3aac6ac2eaa5cfc by Miss Islington (bot) in branch '3.7': bpo-5945: Improve mappings and sequences C API docs. (GH-7029)

[issue5945] PyMapping_Check returns 1 for lists

2018-05-22 Thread miss-islington
Change by miss-islington : -- pull_requests: +6684 ___ Python tracker ___

[issue5945] PyMapping_Check returns 1 for lists

2018-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f5b1183610d5888db3bbd639b1a0c945dbd8f8dd by Serhiy Storchaka in branch 'master': bpo-5945: Improve mappings and sequences C API docs. (GH-7029)

[issue5945] PyMapping_Check returns 1 for lists

2018-05-21 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2018-05-21 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- priority: high -> normal versions: +Python 3.7, Python 3.8 -Python 3.5 ___ Python tracker

[issue5945] PyMapping_Check returns 1 for lists

2018-05-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I propose an alternate PR 7029 which also adds other improvements to the documentation of mappings and sequences C API. -- ___ Python tracker

[issue5945] PyMapping_Check returns 1 for lists

2018-05-21 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +6677 ___ Python tracker ___

[issue5945] PyMapping_Check returns 1 for lists

2017-03-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Proposed wording doesn't looks much informative to me. Maybe just say that PyMapping_Check() also returns 1 for sequences that support slicing? And recommend `PyMapping_Check() && !PySequence_Check()` for true mapping test? -- nosy:

[issue5945] PyMapping_Check returns 1 for lists

2017-03-05 Thread Mariatta Wijaya
Changes by Mariatta Wijaya : -- stage: needs patch -> patch review versions: -Python 3.4 ___ Python tracker ___

[issue5945] PyMapping_Check returns 1 for lists

2017-02-17 Thread James R Barlow
Changes by James R Barlow : -- pull_requests: +105 ___ Python tracker ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2015-07-17 Thread Christian Barcenas
Changes by Christian Barcenas christ...@cbarcenas.com: -- versions: +Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2015-06-29 Thread Ivan Levkivskyi
Changes by Ivan Levkivskyi levkivs...@gmail.com: -- nosy: +levkivskyi ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___ ___ Python-bugs-list

[issue5945] PyMapping_Check returns 1 for lists

2015-02-02 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- versions: +Python 3.5 -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___

[issue5945] PyMapping_Check returns 1 for lists

2015-02-02 Thread Buck Golemon
Buck Golemon added the comment: We've hit this problem today. What are we supposed to do in the meantime? -- nosy: +bukzor ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___

[issue5945] PyMapping_Check returns 1 for lists

2015-02-02 Thread Benjamin Peterson
Benjamin Peterson added the comment: Not use PyMapping_Check? On Mon, Feb 2, 2015, at 14:02, Buck Golemon wrote: Buck Golemon added the comment: We've hit this problem today. What are we supposed to do in the meantime? -- nosy: +bukzor

[issue5945] PyMapping_Check returns 1 for lists

2012-11-18 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2012-05-08 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2011-06-12 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.3 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2011-01-06 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Rather than introduce fixes that break code and hurt performance, I think it would be better to deprecate PyMapping_Check() and wait for a fast, clean C version of the ABCs (that is supposed to be our one obvious way to do

[issue5945] PyMapping_Check returns 1 for lists

2011-01-06 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Rather than introduce fixes that break code and hurt performance, I think it would be better to deprecate PyMapping_Check() and wait for a fast, clean C version of the ABCs (that is supposed to be our one obvious way to do it). Do you also

[issue5945] PyMapping_Check returns 1 for lists

2011-01-06 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Do you also advocate deprecating PySequence_Check()? Perhaps just document PyMapping_Check() as being less informative than before (now it has false positives for sequences). As for the clean C version of the ABCs, I'm

[issue5945] PyMapping_Check returns 1 for lists

2011-01-06 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: As for the clean C version of the ABCs, I'm afraid we could wait quite a bit That may be true. I hope not. The ABCs were meant to solve exactly this problem. At this point, I would rather ignore the problem for 3.2 than to implement a

[issue5945] PyMapping_Check returns 1 for lists

2011-01-05 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Actually, making PyMapping_Check() more robust produces a test failure in test_builtin, because of the following code: # Verify locals stores (used by list comps) eval('[locals() for i in (2,3)]', g, d) eval('[locals()

[issue5945] PyMapping_Check returns 1 for lists

2011-01-04 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Right, calling PyMapping_Check() was never particularly reliable, and extension modules depending on it probably always had subtle bugs. Perhaps it would be nice if we provided a C API to at least some of the ABC package. In the meantime,

[issue5945] PyMapping_Check returns 1 for lists

2011-01-04 Thread Guido van Rossum
Guido van Rossum gu...@python.org added the comment: In the meantime, would it be reasonable to add the moral equivalent of `hasattr(type(op), 'items')` to PyMapping_Check()? That all depends on what it is used for. Which is hard to say without someone following more of the links that

[issue5945] PyMapping_Check returns 1 for lists

2011-01-04 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Modules/posixmodule.c: uses PyMapping_Size(), PyMapping_Keys() and PyMapping_Values() to parse an environment mapping (for execve() and friends). PyFrame_New(): validates the locals argument in pydebug mode (only used for module-level code).

[issue5945] PyMapping_Check returns 1 for lists

2011-01-04 Thread Guido van Rossum
Guido van Rossum gu...@python.org added the comment: The question is, if PyMapping_Check() returns True, and a list is passed, will the code segfault or raise an exception? A segfault would be unacceptable; an exception would be acceptable assuming that the code would have raised an

[issue5945] PyMapping_Check returns 1 for lists

2011-01-04 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Exceptions seem to be raised (for code that can be exercised in Python), but not very obvious ones: eval(x, {}, []) Traceback (most recent call last): File stdin, line 1, in module File string, line 1, in module TypeError: list indices must

[issue5945] PyMapping_Check returns 1 for lists

2011-01-04 Thread Guido van Rossum
Guido van Rossum gu...@python.org added the comment: It looks like PyMapping_Check() already checks for the presence of a fairly arbitrary special operation (mp_subscript). It sounds fine to replace that with a check for the presence of a keys() or items() method (I'm not sure which one is

[issue5945] PyMapping_Check returns 1 for lists

2011-01-03 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Guido, can we have your take on this? -- nosy: +gvanrossum priority: normal - high ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___

[issue5945] PyMapping_Check returns 1 for lists

2011-01-03 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Here's a code search link: http://www.google.com/codesearch?as_q=PyMapping_Check And here's how it currently used internal to the Python codebase: $ ack --cc PyMapping_CheckInclude/abstract.h 1125: PyAPI_FUNC(int)

[issue5945] PyMapping_Check returns 1 for lists

2011-01-03 Thread Guido van Rossum
Guido van Rossum gu...@python.org added the comment: Why did the list implementation get changed in Py3.x? Because we decided to get rid of the sq_slice and sq_ass_slice slots in PySequenceMethods, and that in turn was because we got rid of the slice-related opcodes and the separate

[issue5945] PyMapping_Check returns 1 for lists

2010-07-29 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: -- assignee: georg.brandl - priority: high - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___

[issue5945] PyMapping_Check returns 1 for lists

2010-05-11 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.2 -Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___ ___

[issue5945] PyMapping_Check returns 1 for lists

2009-05-14 Thread Raymond Hettinger
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: rhettinger - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___

[issue5945] PyMapping_Check returns 1 for lists

2009-05-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I understand this is indeed unintuitive. The reason list objects support the C mapping protocol in 3.x is that it is how slicing of lists (and tuples, for that matter) is implemented. Perhaps the documentation should carry a warning about this.

[issue5945] PyMapping_Check returns 1 for lists

2009-05-14 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Personally, I think PyMapping_Check and PySequence_Check should be deprecated and removed. Like their Python counterparts, operator.isMappingType() and operation.isSequenceType(), they are unreliable at best in the face of not LBYL and

[issue5945] PyMapping_Check returns 1 for lists

2009-05-14 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Why did the list implementation get changed in Py3.x? Is it now necessary for any subscripting type to put the same method in both the sequence methods and mapping methods? Was this change necessary? --

[issue5945] PyMapping_Check returns 1 for lists

2009-05-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Why did the list implementation get changed in Py3.x? Is it now necessary for any subscripting type to put the same method in both the sequence methods and mapping methods? Was this change necessary? I think it's a case of foolish

[issue5945] PyMapping_Check returns 1 for lists

2009-05-12 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- priority: - critical versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___

[issue5945] PyMapping_Check returns 1 for lists

2009-05-11 Thread Raymond Hettinger
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5945 ___

[issue5945] PyMapping_Check returns 1 for lists

2009-05-05 Thread John Millikin
New submission from John Millikin jmilli...@gmail.com: In Python 2, PyMapping_Check will return 0 for list objects. In Python 3, it returns 1. Obviously, this makes it rather difficult to differentiate between mappings and other sized iterables. In addition, it differs from the behavior of the