[issue541652] imp.is_builtin() returns bool/int?

2022-04-10 Thread admin


Change by admin :


--
github: None -> 36401

___
Python tracker 

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



[issue532388] reverse copy of sequence returns None

2022-04-10 Thread admin


Change by admin :


--
github: None -> 36288

___
Python tracker 

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



[issue215146] time.strptime returns bad day of month

2022-04-10 Thread admin


Change by admin :


--
github: None -> 33180

___
Python tracker 

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



[issue512005] getrusage() returns struct-like object.

2022-04-10 Thread admin


Change by admin :


--
github: None -> 36018

___
Python tracker 

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



[issue404328] struct.calcsize returns wrong size

2022-04-10 Thread admin


Change by admin :


--
github: None -> 34013

___
Python tracker 

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



[issue221965] 10 in xrange(10) returns 1

2022-04-10 Thread admin


Change by admin :


--
github: None -> 33458

___
Python tracker 

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



[issue523268] pwd.getpw* returns enhanced tuple.

2022-04-10 Thread admin


Change by admin :


--
github: None -> 36170

___
Python tracker 

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



[issue497005] __cmp__ method returns unexpected result

2022-04-10 Thread admin


Change by admin :


--
github: None -> 35829

___
Python tracker 

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



[issue492743] time() returns a negative value

2022-04-10 Thread admin


Change by admin :


--
github: None -> 35737

___
Python tracker 

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



[issue481284] GetFileSecurity returns wrong SID

2022-04-10 Thread admin


Change by admin :


--
github: None -> 35519

___
Python tracker 

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



[issue465527] sqrt on a long int returns invalid resul

2022-04-10 Thread admin


Change by admin :


--
github: None -> 35242

___
Python tracker 

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



[issue421728] readline returns '' when interrupted

2022-04-10 Thread admin


Change by admin :


--
github: None -> 34461

___
Python tracker 

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



[issue405427] SQL2000+XML returns "400.100" status

2022-04-10 Thread admin


Change by admin :


--
github: None -> 34048

___
Python tracker 

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



[issue404327] struct.calcsize returns wrong size

2022-04-10 Thread admin


Change by admin :


--
github: None -> 34012

___
Python tracker 

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



[issue229788] cgi module. FieldStorage class returns keys blank fields.

2022-04-10 Thread admin


Change by admin :


--
github: None -> 33781

___
Python tracker 

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



[issue215831] 0.0**-2.0 returns "inf" instead of raising ValueError

2022-04-10 Thread admin


Change by admin :


___
Python tracker 

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



[issue219450] dictionary values returns pointers when the value is a list

2022-04-10 Thread admin


Change by admin :


___
Python tracker 

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



[issue215146] time.strptime returns bad day of month

2022-04-10 Thread admin


Change by admin :


___
Python tracker 

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



[issue210867] DCOracle select max() always returns integers (PR#289)

2022-04-10 Thread admin


Change by admin :


___
Python tracker 

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



[issue213934] string * int silently returns wrong answer for certain ints

2022-04-10 Thread admin


Change by admin :


___
Python tracker 

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



[issue400706] minidom __repr__ returns Unicode strings

2022-04-10 Thread admin


Change by admin :


___
Python tracker 

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



[issue221965] 10 in xrange(10) returns 1

2022-04-10 Thread admin


Change by admin :


--
github: None -> 33458

___
Python tracker 

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



[issue219450] dictionary values returns pointers when the value is a list

2022-04-10 Thread admin


Change by admin :


--
github: None -> 33402

___
Python tracker 

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



[issue215831] 0.0**-2.0 returns "inf" instead of raising ValueError

2022-04-10 Thread admin


Change by admin :


--
github: None -> 33252

___
Python tracker 

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



[issue213934] string * int silently returns wrong answer for certain ints

2022-04-10 Thread admin


Change by admin :


--
github: None -> 33080

___
Python tracker 

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



[issue210867] DCOracle select max() always returns integers (PR#289)

2022-04-10 Thread admin


Change by admin :


--
github: None -> 32865

___
Python tracker 

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



[issue400706] minidom __repr__ returns Unicode strings

2022-04-10 Thread admin


Change by admin :


--
github: None -> 32506

___
Python tracker 

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



[issue47205] posix.sched_{get|set}affinity(-1) no longer returns ProcessLookup causing test failures on FreeBSD

2022-04-05 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
title: test_sched_getaffinity and setaffinity fail on FreeBSD buildbit -> 
posix.sched_{get|set}affinity(-1) no longer returns ProcessLookup causing test 
failures on FreeBSD

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



[issue47207] Switch datetime docstrings / documentation to using "Returns" rather than "Return"?

2022-04-05 Thread Stanley


Stanley  added the comment:

Is there a bpo page or some sort that discusses why the imperative mood is used 
over the indicative mood other than convention of PEP 257? I found this 
(https://mail.python.org/pipermail/tutor/2012-May/089584.html) question and 
answer that seems to make sense, but it's not quite an official source.

If the reason for using imperative mood in docstrings doesn't apply to 
documentation, then I think there wouldn't be any problems in changing it. One 
thing raised in the mail thread was that 'Returns ...' isn't strictly 
grammatical, so perhaps that's something to consider.

--

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



[issue47207] Switch datetime docstrings / documentation to using "Returns" rather than "Return"?

2022-04-03 Thread Paul Ganssle


New submission from Paul Ganssle :

In bpo-9305, Fred Drake recommends preferring `Returns ...` over the imperative 
`Return ...`: https://bugs.python.org/issue9305#msg110912

Currently we're pretty consistent about `Return ...`, which is consistent with 
PEP 257: https://peps.python.org/pep-0257/

That said, I actually think "Returns ..." sounds much better in the 
documentation, and I'd be happy to see it changed if others agree.

I have spun this off from bpo-9305 so that we can unblock 
https://github.com/python/cpython/pull/31697.

--
assignee: docs@python
components: Documentation
messages: 416628
nosy: belopolsky, docs@python, fdrake, p-ganssle, slateny
priority: normal
severity: normal
status: open
title: Switch datetime docstrings / documentation to using "Returns" rather 
than "Return"?
versions: Python 3.11

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-31 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
resolution:  -> fixed
stage: patch review -> commit review
status: open -> closed

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-31 Thread miss-islington


miss-islington  added the comment:


New changeset 9ed179b07df6ce7432f972f5d069a7c8dee56e79 by Miss Islington (bot) 
in branch '3.10':
bpo-47151: Fallback to fork when vfork fails in subprocess. (GH-32186)
https://github.com/python/cpython/commit/9ed179b07df6ce7432f972f5d069a7c8dee56e79


--

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-31 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +30295
pull_request: https://github.com/python/cpython/pull/32219

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-31 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 4a08c4c469d36f99d3a5e0f17ad82ab35dcf2835 by Gregory P. Smith in 
branch 'main':
bpo-47151: Fallback to fork when vfork fails in subprocess. (GH-32186)
https://github.com/python/cpython/commit/4a08c4c469d36f99d3a5e0f17ad82ab35dcf2835


--

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-31 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks. I had wondered if this was really a pid=1 restriction or not, but I 
could definitely imagine kernel scenarios where vfork is simply forbidden 
regardless. There are a variety of policy mechanisms in kernels, mainline Linux 
or not, that _could_ do that kind of thing.

As much as I'd like to expose that the fallback happened, emitting to stderr 
isn't friendly and using warnings from this code is complicated so I'm inclined 
to keep the silent fallback on failure simple as is until someone can 
demonstrate of it causing a practical problem.

Outside of unusual configurations, if this were ever happening when it is not 
expected, people observing low subprocess performance could strace and witness 
the vfork syscall failure.

I'll merge once our CI is happy.

--

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-31 Thread Марк Коренберг

Марк Коренберг  added the comment:

Well.
1. We use Python as PID 1. In PID namespace.
2. Further investigation gave information that vfork()+pid=1 actually WORKS. 
The problem is connected with another weird thing in kernel (undocumented 
unshare() flags).
3. The logic to try fork() after vfork() has failed is NICE. Please merge. I 
would also write a message to stderr in case vfork() failed.

P.S. Program may or may not be static in order to work as PID=1.

--

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-30 Thread STINNER Victor


STINNER Victor  added the comment:

> Any possibility that you can test the attached PR as pid 1?

Python should be built as a static binary and can be used as the init process 
on the kernel command line, no? I'm not sure that "static binary" is a 
requirement, since I'm commonly using init=/usr/bin/bash to fix a broken Linux, 
and on my Fedora, this program is "dynamically linked".

Who uses Python as pid 1? I'm now curious :-)

--
nosy: +vstinner

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-29 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Any possibility that you can test the attached PR as pid 1?

--

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-29 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +patch
pull_requests: +30263
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/32186

___
Python tracker 

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



[issue47151] subprocess fails when used as init, vfork() returns EINVAL if PID=1

2022-03-29 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
components: +Extension Modules -Library (Lib)
stage:  -> needs patch
title: vfork() returns EINVAL if PID=1 -> subprocess fails when used as init, 
vfork() returns EINVAL if PID=1
type:  -> behavior

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



[issue47151] vfork() returns EINVAL if PID=1

2022-03-29 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue47151] vfork() returns EINVAL if PID=1

2022-03-29 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue47151] vfork() returns EINVAL if PID=1

2022-03-29 Thread Марк Коренберг

New submission from Марк Коренберг :

The bug introduced here: #35823

If os.gepid() == 1, vfork() does not work and returns EINVAL.

Please add check for the current pid in condition where CPython chooses between 
fork() and vfork().

--
components: Library (Lib)
messages: 416252
nosy: socketpair
priority: normal
severity: normal
status: open
title: vfork() returns EINVAL if PID=1
versions: Python 3.10, Python 3.11

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
pull_requests:  -30123

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
pull_requests: +30123
pull_request: https://github.com/python/cpython/pull/32032

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
pull_requests:  -30121

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2022-03-21 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
keywords: +patch
nosy: +jkloth
nosy_count: 7.0 -> 8.0
pull_requests: +30121
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32032

___
Python tracker 

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



[issue47055] `issubclass` on two different subclasses of abstract base class like `os.PathLike` returns unexpected value on early versions of Py3.7 and Py3.8

2022-03-20 Thread mobiusklein


mobiusklein  added the comment:

Understood. It's probably good practice to keep the interpreter version up to 
date in any case when debugging.

--
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue47055] `issubclass` on two different subclasses of abstract base class like `os.PathLike` returns unexpected value on early versions of Py3.7 and Py3.8

2022-03-18 Thread Eric V. Smith


Eric V. Smith  added the comment:

Since those releases are no longer supported, I don't think there's any place 
you could put this that would be seen. And we wouldn't want to put a note in a 
current release about a bug in a non-supported version that was fixed in 
another non-supported version.

--
nosy: +eric.smith

___
Python tracker 

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



[issue47055] `issubclass` on two different subclasses of abstract base class like `os.PathLike` returns unexpected value on early versions of Py3.7 and Py3.8

2022-03-17 Thread mobiusklein


New submission from mobiusklein :

The following code looks correct:

```python
import os

class A(os.PathLike):
pass

class B(os.PathLike):
pass

assert issubclass(A, os.PathLike) # direct inheritance relationship
assert issubclass(B, os.PathLike) # direct inheritance relationship
assert not issubclass(A, B) # A is not derived from B or vice-versa
```

On Python 3.7.0-3.7.6 and 3.8.0-3.8.1 the third assertion fails. The expected 
behavior was restored in 3.7.7 and 3.8.2. This seems to be around when the 
internals of `abc` were translated to C.

Given that the behavior was fixed, but a bug fix matching this behavior wasn't 
listed in the changelog, the only resolution is to document that this behavior 
may be extant in older but still supported minor versions of Python. Where 
should that text be placed?

--
components: Library (Lib)
messages: 415467
nosy: mobiusklein
priority: normal
severity: normal
status: open
title: `issubclass` on two different subclasses of abstract base class like 
`os.PathLike` returns unexpected value on early versions of Py3.7 and Py3.8
type: behavior
versions: Python 3.7, Python 3.8

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



[issue42760] inspect.iscoroutine returns False for asynchronous generator methods

2022-03-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list
Thanks to MRAB and Chris Angelico for your help.  Here is how I implemented the 
string conversion, and it works correctly now for a library call that needs a 
list converted to a string (error handling not shown):

PyObject* str_sentence = PyObject_Str(pSentence);  
PyObject* separator = PyUnicode_FromString(" ");
PyObject* str_join = PyUnicode_Join(separator, pSentence);
Py_DECREF(separator);
PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr, "word_tokenize");
PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, str_join, 0);

That produces what I need (this is the REPR of pWTok):

"['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"

Thanks again to both of you. 

Jen


Mar 7, 2022, 11:03 by pyt...@mrabarnett.plus.com:

> On 2022-03-07 17:05, Jen Kris wrote:
>
>> Thank you MRAB for your reply.
>>
>> Regarding your first question, pSentence is a list.  In the nltk library, 
>> nltk.word_tokenize takes a string, so we convert sentence to string before 
>> we call nltk.word_tokenize:
>>
>> >>> sentence = " ".join(sentence)
>> >>> pt = nltk.word_tokenize(sentence)
>> >>> print(sentence)
>> [ Emma by Jane Austen 1816 ]
>>
>> But with the C API it looks like this:
>>
>> PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
>> PyObject* str_sentence = PyObject_Str(pSentence); // Convert to string
>>
>> ; See what str_sentence looks like:
>> PyObject* repr_str = PyObject_Repr(str_sentence);
>> PyObject* str_str = PyUnicode_AsEncodedString(repr_str, "utf-8", "~E~");
>> const char *bytes_str = PyBytes_AS_STRING(str_str);
>> printf("REPR_String: %s\n", bytes_str);
>>
>> REPR_String: "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
>>
>> So the two string representations are not the same – or at least the   
>> PyUnicode_AsEncodedString is not the same, as each item is surrounded by 
>> single quotes.
>>
>> Assuming that the conversion to bytes object for the REPR is an accurate 
>> representation of str_sentence, it looks like I need to strip the quotes 
>> from str_sentence before “PyObject* pWTok = 
>> PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0).”
>>
>> So my questions now are (1) is there a C API function that will convert a 
>> list to a string exactly the same way as ‘’.join, and if not then (2) how 
>> can I strip characters from a string object in the C API?
>>
> Your Python code is joining the list with a space as the separator.
>
> The equivalent using the C API is:
>
>     PyObject* separator;
>     PyObject* joined;
>
>     separator = PyUnicode_FromString(" ");
>     joined = PyUnicode_Join(separator, pSentence);
>     Py_DECREF(sep);
>
>>
>> Mar 6, 2022, 17:42 by pyt...@mrabarnett.plus.com:
>>
>>  On 2022-03-07 00:32, Jen Kris via Python-list wrote:
>>
>>  I am using the C API in Python 3.8 with the nltk library, and
>>  I have a problem with the return from a library call
>>  implemented with PyObject_CallFunctionObjArgs.
>>
>>  This is the relevant Python code:
>>
>>  import nltk
>>  from nltk.corpus import gutenberg
>>  fileids = gutenberg.fileids()
>>  sentences = gutenberg.sents(fileids[0])
>>  sentence = sentences[0]
>>  sentence = " ".join(sentence)
>>  pt = nltk.word_tokenize(sentence)
>>
>>  I run this at the Python command prompt to show how it works:
>>
>>  sentence = " ".join(sentence)
>>  pt = nltk.word_tokenize(sentence)
>>  print(pt)
>>
>>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>>  type(pt)
>>
>>  
>>
>>  This is the relevant part of the C API code:
>>
>>  PyObject* str_sentence = PyObject_Str(pSentence);
>>  // nltk.word_tokenize(sentence)
>>  PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr,
>>  "word_tokenize");
>>  PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok,
>>  str_sentence, 0);
>>
>>  (where pModule_mstr is the nltk library).
>>
>>  That should produce a list with a length of 7 that looks like
>>  it does on the command line version shown above:
>>
>>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>>  But instead the C API produces a list with a length of 24, and
>>  the REPR looks like this:
>>
>>  '[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\',
>>  "\'by", "\'", \',\', "\'Jane", "\'", \',\', "\'Austen", "\'",
>>  \',\', "\'1816", "\'", \',\', "\'", \']\', "\'", \']\']'
>>
>>  I also tried this with PyObject_CallMethodObjArgs and
>>  PyObject_Call without success.
>>
>>  Thanks for any help on this.
>>
>>  What is pSentence? Is it what you think it is?
>>  To me it looks like it's either the list:
>>
>>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>>  or that list as a string:
>>
>>  "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
>>
>>  and that what you're tokenising.
>>  -- https://mail.python.org/mailman/listinfo/python-list
>>
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread MRAB

On 2022-03-07 17:05, Jen Kris wrote:

Thank you MRAB for your reply.

Regarding your first question, pSentence is a list.  In the nltk 
library, nltk.word_tokenize takes a string, so we convert sentence to 
string before we call nltk.word_tokenize:


>>> sentence = " ".join(sentence)
>>> pt = nltk.word_tokenize(sentence)
>>> print(sentence)
[ Emma by Jane Austen 1816 ]

But with the C API it looks like this:

PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
PyObject* str_sentence = PyObject_Str(pSentence); // Convert to string

; See what str_sentence looks like:
PyObject* repr_str = PyObject_Repr(str_sentence);
PyObject* str_str = PyUnicode_AsEncodedString(repr_str, "utf-8", "~E~");
const char *bytes_str = PyBytes_AS_STRING(str_str);
printf("REPR_String: %s\n", bytes_str);

REPR_String: "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"

So the two string representations are not the same – or at least the   
PyUnicode_AsEncodedString is not the same, as each item is surrounded 
by single quotes.


Assuming that the conversion to bytes object for the REPR is an 
accurate representation of str_sentence, it looks like I need to strip 
the quotes from str_sentence before “PyObject* pWTok = 
PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0).”


So my questions now are (1) is there a C API function that will 
convert a list to a string exactly the same way as ‘’.join, and if not 
then (2) how can I strip characters from a string object in the C API?



Your Python code is joining the list with a space as the separator.

The equivalent using the C API is:

    PyObject* separator;
    PyObject* joined;

    separator = PyUnicode_FromString(" ");
    joined = PyUnicode_Join(separator, pSentence);
    Py_DECREF(sep);



Mar 6, 2022, 17:42 by pyt...@mrabarnett.plus.com:

On 2022-03-07 00:32, Jen Kris via Python-list wrote:

I am using the C API in Python 3.8 with the nltk library, and
I have a problem with the return from a library call
implemented with PyObject_CallFunctionObjArgs.

This is the relevant Python code:

import nltk
from nltk.corpus import gutenberg
fileids = gutenberg.fileids()
sentences = gutenberg.sents(fileids[0])
sentence = sentences[0]
sentence = " ".join(sentence)
pt = nltk.word_tokenize(sentence)

I run this at the Python command prompt to show how it works:

sentence = " ".join(sentence)
pt = nltk.word_tokenize(sentence)
print(pt)

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

type(pt)



This is the relevant part of the C API code:

PyObject* str_sentence = PyObject_Str(pSentence);
// nltk.word_tokenize(sentence)
PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr,
"word_tokenize");
PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok,
str_sentence, 0);

(where pModule_mstr is the nltk library).

That should produce a list with a length of 7 that looks like
it does on the command line version shown above:

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

But instead the C API produces a list with a length of 24, and
the REPR looks like this:

'[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\',
"\'by", "\'", \',\', "\'Jane", "\'", \',\', "\'Austen", "\'",
\',\', "\'1816", "\'", \',\', "\'", \']\', "\'", \']\']'

I also tried this with PyObject_CallMethodObjArgs and
PyObject_Call without success.

Thanks for any help on this.

What is pSentence? Is it what you think it is?
To me it looks like it's either the list:

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

or that list as a string:

"['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"

and that what you're tokenising.
-- 
https://mail.python.org/mailman/listinfo/python-list




--
https://mail.python.org/mailman/listinfo/python-list


Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Chris Angelico
On Tue, 8 Mar 2022 at 04:13, Jen Kris  wrote:
>
>
> The PyObject str_sentence is a string representation of a list.  I need to 
> convert the list to a string like "".join because that's what the library 
> call takes.
>

What you're doing is the equivalent of str(sentence), not
"".join(sentence). Since the join method is part of the string
protocol, you'll find it here:

https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_Join

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list

The PyObject str_sentence is a string representation of a list.  I need to 
convert the list to a string like "".join because that's what the library call 
takes.  


Mar 7, 2022, 09:09 by ros...@gmail.com:

> On Tue, 8 Mar 2022 at 04:06, Jen Kris via Python-list
>  wrote:
>
>> But with the C API it looks like this:
>>
>> PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
>> PyObject* str_sentence = PyObject_Str(pSentence);  // Convert to string
>>
>> PyObject* repr_str = PyObject_Repr(str_sentence);
>>
>
> You convert it to a string, then take the representation of that. Is
> that what you intended?
>
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Chris Angelico
On Tue, 8 Mar 2022 at 04:06, Jen Kris via Python-list
 wrote:
> But with the C API it looks like this:
>
> PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
> PyObject* str_sentence = PyObject_Str(pSentence);  // Convert to string
>
> PyObject* repr_str = PyObject_Repr(str_sentence);

You convert it to a string, then take the representation of that. Is
that what you intended?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list
Thank you MRAB for your reply.

Regarding your first question, pSentence is a list.  In the nltk library, 
nltk.word_tokenize takes a string, so we convert sentence to string before we 
call nltk.word_tokenize:

>>> sentence = " ".join(sentence)
>>> pt = nltk.word_tokenize(sentence)
>>> print(sentence)
[ Emma by Jane Austen 1816 ]

But with the C API it looks like this:

PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
PyObject* str_sentence = PyObject_Str(pSentence);  // Convert to string

; See what str_sentence looks like:
PyObject* repr_str = PyObject_Repr(str_sentence);  
PyObject* str_str = PyUnicode_AsEncodedString(repr_str, "utf-8", "~E~");  
const char *bytes_str = PyBytes_AS_STRING(str_str);
printf("REPR_String: %s\n", bytes_str); 

REPR_String: "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
So the two string representations are not the same – or at least the   
PyUnicode_AsEncodedString is not the same, as each item is surrounded by single 
quotes. 

Assuming that the conversion to bytes object for the REPR is an accurate 
representation of str_sentence, it looks like I need to strip the quotes from 
str_sentence before “PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, 
str_sentence, 0).”   

So my questions now are (1) is there a C API function that will convert a list 
to a string exactly the same way as ‘’.join, and if not then (2) how can I 
strip characters from a string object in the C API? 

Thanks.



Mar 6, 2022, 17:42 by pyt...@mrabarnett.plus.com:

> On 2022-03-07 00:32, Jen Kris via Python-list wrote:
>
>> I am using the C API in Python 3.8 with the nltk library, and I have a 
>> problem with the return from a library call implemented with 
>> PyObject_CallFunctionObjArgs.
>>
>> This is the relevant Python code:
>>
>> import nltk
>> from nltk.corpus import gutenberg
>> fileids = gutenberg.fileids()
>> sentences = gutenberg.sents(fileids[0])
>> sentence = sentences[0]
>> sentence = " ".join(sentence)
>> pt = nltk.word_tokenize(sentence)
>>
>> I run this at the Python command prompt to show how it works:
>>
> sentence = " ".join(sentence)
> pt = nltk.word_tokenize(sentence)
> print(pt)
>
>> ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
> type(pt)
>
>> 
>>
>> This is the relevant part of the C API code:
>>
>> PyObject* str_sentence = PyObject_Str(pSentence);
>> // nltk.word_tokenize(sentence)
>> PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr, "word_tokenize");
>> PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0);
>>
>> (where pModule_mstr is the nltk library).
>>
>> That should produce a list with a length of 7 that looks like it does on the 
>> command line version shown above:
>>
>> ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>> But instead the C API produces a list with a length of 24, and the REPR 
>> looks like this:
>>
>> '[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\', "\'by", "\'", 
>> \',\', "\'Jane", "\'", \',\', "\'Austen", "\'", \',\', "\'1816", "\'", 
>> \',\', "\'", \']\', "\'", \']\']'
>>
>> I also tried this with PyObject_CallMethodObjArgs and PyObject_Call without 
>> success.
>>
>> Thanks for any help on this.
>>
> What is pSentence? Is it what you think it is?
> To me it looks like it's either the list:
>
>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>
> or that list as a string:
>
>  "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
>
> and that what you're tokenising.
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-06 Thread MRAB

On 2022-03-07 00:32, Jen Kris via Python-list wrote:

I am using the C API in Python 3.8 with the nltk library, and I have a problem 
with the return from a library call implemented with 
PyObject_CallFunctionObjArgs.

This is the relevant Python code:

import nltk
from nltk.corpus import gutenberg
fileids = gutenberg.fileids()
sentences = gutenberg.sents(fileids[0])
sentence = sentences[0]
sentence = " ".join(sentence)
pt = nltk.word_tokenize(sentence)

I run this at the Python command prompt to show how it works:

sentence = " ".join(sentence)
pt = nltk.word_tokenize(sentence)
print(pt)

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

type(pt)



This is the relevant part of the C API code:

PyObject* str_sentence = PyObject_Str(pSentence);
// nltk.word_tokenize(sentence)
PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr, "word_tokenize");
PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0);

(where pModule_mstr is the nltk library).

That should produce a list with a length of 7 that looks like it does on the 
command line version shown above:

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

But instead the C API produces a list with a length of 24, and the REPR looks 
like this:

'[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\', "\'by", "\'", \',\', "\'Jane", "\'", \',\', "\'Austen", "\'", 
\',\', "\'1816", "\'", \',\', "\'", \']\', "\'", \']\']'

I also tried this with PyObject_CallMethodObjArgs and PyObject_Call without 
success.

Thanks for any help on this.


What is pSentence? Is it what you think it is?
To me it looks like it's either the list:

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

or that list as a string:

"['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"

and that what you're tokenising.
--
https://mail.python.org/mailman/listinfo/python-list


C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-06 Thread Jen Kris via Python-list
I am using the C API in Python 3.8 with the nltk library, and I have a problem 
with the return from a library call implemented with 
PyObject_CallFunctionObjArgs.  

This is the relevant Python code:

import nltk
from nltk.corpus import gutenberg
fileids = gutenberg.fileids()
sentences = gutenberg.sents(fileids[0])
sentence = sentences[0]
sentence = " ".join(sentence)
pt = nltk.word_tokenize(sentence)

I run this at the Python command prompt to show how it works:
>>> sentence = " ".join(sentence)
>>> pt = nltk.word_tokenize(sentence)
>>> print(pt)
['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>> type(pt)


This is the relevant part of the C API code:

PyObject* str_sentence = PyObject_Str(pSentence);  
// nltk.word_tokenize(sentence)  
PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr, "word_tokenize");
PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0);

(where pModule_mstr is the nltk library). 

That should produce a list with a length of 7 that looks like it does on the 
command line version shown above:

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

But instead the C API produces a list with a length of 24, and the REPR looks 
like this:

'[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\', "\'by", "\'", \',\', 
"\'Jane", "\'", \',\', "\'Austen", "\'", \',\', "\'1816", "\'", \',\', "\'", 
\']\', "\'", \']\']'

I also tried this with PyObject_CallMethodObjArgs and PyObject_Call without 
success. 

Thanks for any help on this. 

Jen

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue5043] get_msvcr() returns None rather than []

2022-03-04 Thread Alex Zunegin


Alex Zunegin  added the comment:

This messes up building Cython extensions on MSYS2 and MINGW. Still here as of 
setuptools 60. 

There is no line 
```
return [] -
```
at the end. Adding it helps.

--
nosy: +gesserat

___
Python tracker 

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



[issue46869] platform.release() and sys returns wrong version on Windows 11

2022-02-26 Thread Eryk Sun


Eryk Sun  added the comment:

platform.release() returns platform.uname().release, which comes from 
platform.win32_ver() in Windows [1]. The issue with Windows 11 is being 
discussed in bpo-45382, but no PR has been submitted yet to resolve the issue.

> >>> sys.getwindowsversion().platform_version
> (10, 0, 22000)

This result is correct [2], but you should use platform.version() instead. The 
major.minor version of Windows 11 is 10.0. The build number for Windows 11 is 
22000 and above. The latest build number for Windows 10, in contrast, is 19044.

The system version number concerns API compatibility, not user-interface 
updates or marketing names. Windows XP, XP Professional x64 Edition, Vista, 7, 
8, and 8.1 correspond respectively to Windows system versions 5.1, 5.2, 6.0, 
6.1, 6.2, and 6.3. System versions 7.x, 8.x, and 9.x were skipped. Version 10.0 
is the first system version with two client workstation releases, Windows 10 
and Windows 11. It's thus the first time that the build number is required to 
differentiate the release name.

The `platform_version` attribute of the sys.getwindowsversion() result is 
supposed to be the true OS version in case the API is using a 
compatibility-mode version. It's based on the product version of the system 
file "kernel32.dll". However, it turns out that this is also not reliably the 
true OS version. The sys documentation was updated with a note that suggests 
using the platform module instead [3].

---

[1] https://docs.python.org/3/library/platform.html#platform.win32_ver
[2] https://en.wikipedia.org/wiki/Windows_11_version_history#Version_history
[3] https://docs.python.org/3/library/sys.html#sys.getwindowsversion

--
nosy: +eryksun
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> platform() is not able to detect windows 11

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



[issue46869] platform.release() and sys returns wrong version on Windows 11

2022-02-26 Thread Evernow


New submission from Evernow :

Hello.

On Windows 11 the platform module returns Windows 10 instead of Windows 11, 
same for the sys module. 

Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.release()
'10'
>>> import sys
>>> sys.getwindowsversion().platform_version
(10, 0, 22000)

--
components: Windows
messages: 414129
nosy: Evernow, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: platform.release() and sys returns wrong version on Windows 11
type: behavior
versions: Python 3.10

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



[issue42760] inspect.iscoroutine returns False for asynchronous generator methods

2022-02-26 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This seems to be a duplicate of https://bugs.python.org/issue37190

--
nosy: +xtreak

___
Python tracker 

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



[issue42760] inspect.iscoroutine returns False for asynchronous generator methods

2022-02-26 Thread Kumar Aditya


Change by Kumar Aditya :


--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46697] _ctypes_simple_instance returns inverted logic

2022-02-09 Thread Eryk Sun


Change by Eryk Sun :


--
stage:  -> patch review
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46697] _ctypes_simple_instance returns inverted logic

2022-02-09 Thread hydroflask


hydroflask  added the comment:

I place that patch into the public domain, I claim no ownership over that 
patch. The patch is attached purely for demonstration purposes.

--

___
Python tracker 

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



[issue46697] _ctypes_simple_instance returns inverted logic

2022-02-09 Thread hydroflask


New submission from hydroflask :

`_ctypes_simple_instance` in _ctypes.c returns the opposite logic of what its 
documentation claims. It is supposed to return true when the argument (a type 
object) is a direct subclass of `Simple_Type` (`_SimpleCData` in Python code). 
However it returns false instead.

No bugs have manifested from this because all of the call sites ( 
`callproc.c::GetResult`, 
`callbacks.c::_CallPythonObject`,_`ctypes.c::PyCData_get`, 
`_ctypes.c::Simple_from_outparm`) invert the return value of this function. The 
last example, `ctypes.c::Simple_from_outparm` only calls `Simple_get_value()` 
when `_ctypes_simple_instance` returns false, which makes sense because 
otherwise the invocation of `_ctypes.c::Simple_from_outparm()` could trigger an 
assertion error.

This is not just simply an issue of inverted logic because the logic isn't 
inverted in all cases. In `_ctypes_simple_instance` in the case when 
`PyCSimpleTypeObject_Check(type)` returns false, if this were supposed to be 
perfect inverted logic then the whole routine would return 1 (True) not 0. 
Fortunately, due to the way the code is structured, I don't think there is a 
case when `PyCSimpleTypeObject_Check(type)` returns false so the incorrect case 
where it returns a constant 0 is effectively dead code.

I have compiled a version of Python with the attached patch and run "make test" 
with no issues.

--
components: ctypes
files: _ctypes_simple_instance_inverted.patch
keywords: patch
messages: 412947
nosy: hydroflask
priority: normal
severity: normal
status: open
title: _ctypes_simple_instance returns inverted logic
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9
Added file: 
https://bugs.python.org/file50612/_ctypes_simple_instance_inverted.patch

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



[issue31057] pydoc for tempfile.TemporaryDirectory should say it returns the name

2022-02-06 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue31057] pydoc for tempfile.TemporaryDirectory should say it returns the name

2022-01-25 Thread Irit Katriel


Irit Katriel  added the comment:

The OP seems to have abandoned this and all it got was a +0 for changing, so I 
suggest we close it.

--
nosy: +iritkatriel
resolution:  -> wont fix
status: open -> pending

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-25 Thread Ben Avrahami


Ben Avrahami  added the comment:

IMHO, I don't think any alternative to aviramha's solution addresses the issue, 
And I don't think the need is niche enough to be ignored.

PyType_HasFeature excludes strings, bytes, and other esoteric types.
PyMapping_Check includes mappings like dict and MappingProxyType.
PySequence_Check includes non-dict mappings like MappingProxyType.

The only possible solutions right now are:

a. Import the "collections.abc.Sequence" class into C and run 
"PyObject_IsInstance" on it. This would be the correct solution, but it would 
be slower than aviramha's propsal.
b. Perform's aviramha's proposal manually: first check the 
"Py_TPFLAGS_SEQUENCE" feature flag, and fallback for instance checking strings, 
bytecodes, and other esoteric types individually. This would be correct and 
fast, but is cumbersome to perform, and users are bound to forget some types.

A question as simple as "would isinstance(X, ) returns true?" 
should be easier to answer for low-level developer, one only needs to look at 
the finagling numpy, among others, has to perform to parse a sequence (the 
relevant function in numpy is called "PyArray_FromAny").

A simple implementation of a new function for non-CPython alternatives will be 
to do implement solution a: import "collections.abc.Sequence", and check for 
instance. For CPYTHON, this can be optimized by implementing solution b.

There is already a precedence for ABI functions that only exist because its 
trivial implementation can be optimized with CPython specific behaviour. I 
don't understand the reluctance to add this one.

--
nosy: +avrahami.ben

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



[issue42091] strftime returns empty string for -d, -I 3.8.3

2022-01-23 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I would really like this to be left alone.  We've been without a reliable 
version for over a decade.  That is strong evidence that we really don't need 
this unless it can be done perfectly (which it can't).  

Also, PyMapping_Check is just a CPython specific optimization (and a flawed 
one).  Because it can't be made completely reliable, we should not encourage 
people to use it, nor should we enshrine it in the stable API.

And if a modification can potentially break long stable code (such as that it 
the re module), then we absolutely shouldn't do it. x

Further, there is a general design issue.  Abstract base classes were invented 
to solve this specific problem (distinguishing mappings from sequences).  ABCs 
(and typing) are a now well established practice, and it is foolish to try to 
do an end run around using them.

I am strongly opposed to this going forward and request that a PEP be made if 
it is pursued further.   It is an SC level decision to allow stable code to be 
broken, to guarantee a CPython specific API for something that cannot be made 
correct in the general case, and to bypass the intended way to do it.

If the core concern is that isinstance() checks for ABCs are too slow, then 
efforts should be made to optimize them rather than creating an unreliable, 
CPython only alternative.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is difficult to distinguish Mapping from Sequence because they have the same 
set of dunder methods. The difference is only in semantic -- __iter__ yields 
items for Sequence and keys for Mapping, __getitem__ gets an item by index (or 
a sequence by slice) for Sequence and value by key for Mapping. But semantic 
cannot be tested here.

In these cases when both Sequence and Mapping are accepted but handled 
differently (like in the dict constructor) we test for existence of the "keys" 
method. It is not good, because it is not a dunder method, and therefore should 
be looked up at instance, not only at a type.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-23 Thread Aviram


Aviram  added the comment:

I sent it to sig-capi - 
https://mail.python.org/archives/list/capi-...@python.org/thread/T6DHEKHKKZIYU2GEPGHUQJ3DHTJXZGWW/

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

I'd post it to capi-sig, or to the existing thread on python-dev. But here's a 
good place too, especially if you want feedback from a smaller group of people 
first.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-19 Thread Aviram


Aviram  added the comment:

Sure, I will do so. The proposal should be written here, right?

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

Changing the existing functions is a no-go for backwards compatibility reasons. 
I think the best way forward would be to add a new function, and then possibly 
deprecate the old one if it's deemed dangerous.

If you want to push this forward, could you summarize the use case(s) and 
expected behavior (docs) for such a function? It probably doesn't need a PEP, 
but it's worth looking here for what to think about when making a proposal: 
https://www.python.org/dev/peps/pep-0001/#what-belongs-in-a-successful-pep

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2022-01-18 Thread milahu


milahu  added the comment:

python-ideas thread
https://mail.python.org/archives/list/python-id...@python.org/thread/V53XGQPIY7ZAISMTQHPHKGWZNSN5EXQG/

--

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2022-01-18 Thread Irit Katriel


Irit Katriel  added the comment:

Ok, I reopened this as an enhancement request for mimetypes to know about the 
'deprecated' types. If you want to push it forward it might be a good idea to 
bring this up on python-ideas as well.

--

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2022-01-18 Thread Irit Katriel


Change by Irit Katriel :


--
stage: resolved -> 

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2022-01-18 Thread Irit Katriel


Change by Irit Katriel :


--
resolution: duplicate -> 
status: closed -> open
type: behavior -> enhancement

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2022-01-18 Thread milahu


milahu  added the comment:

edit:

-  mimetype_of_ext[ext] = mimetype
+  else:
+# add new entry
+mimetype_of_ext[ext] = mimetype

--

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2022-01-18 Thread milahu


milahu  added the comment:

this issue is different than Issue32462
because here, both entries are valid

```
cat /etc/mime.types | grep javascript
application/javascriptjs
application/x-javascript  js
```

but the alphabetical ordering of the file
makes the last entry take precedence

python could be smarter at parsing the /etc/mime.types file
in that it could give lower precedence to the deprecated types

pseudocode:

deprecated_mimetypes = set(...) # values from rfc4329
mimetype_of_ext = dict()
# parser loop
for ...
  ext = "..."
  mimetype = "..."
  if ext in mimetype_of_ext:
old_mimetype = mimetype_of_ext[ext]
if old_mimetype in deprecated_mimetypes:
  mimetype_of_ext[ext] = mimetype # replace old with new
  # assume that mimetype is not deprecated
  mimetype_of_ext[ext] = mimetype

--

___
Python tracker 

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



[issue46035] mimetypes.guess_type returns deprecated mimetype application/x-javascript

2022-01-18 Thread Irit Katriel


Irit Katriel  added the comment:

As noted in Issue32462, the fact that system files take precedence over the 
definitions in the sodlib is a feature, so the proposed patch to reverse this 
behaviour cannot be applied unless it is decided to change the API in this way. 
 That would require a discussion on python-ideas. If you want to being it up 
there, and there is a decision to change the behaviour, please create a new 
issue.

--
nosy: +iritkatriel
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> mimetypes.guess_type() returns incorrectly formatted type

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



[issue35974] os.DirEntry.inode() returns invalid value within Docker container

2022-01-16 Thread Irit Katriel


Irit Katriel  added the comment:

3.7 is no longer maintained. Please create a new issue if you are seeing this 
on a current python version (>= 3.9).

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue6686] xml.sax.xmlreader.XMLReader.getProperty (xml.sax.handler.property_xml_string) returns bytes

2022-01-15 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue6686] xml.sax.xmlreader.XMLReader.getProperty (xml.sax.handler.property_xml_string) returns bytes

2022-01-15 Thread Yassir Karroum


Change by Yassir Karroum :


--
nosy: +ukarroum
nosy_count: 7.0 -> 8.0
pull_requests: +28814
pull_request: https://github.com/python/cpython/pull/30612

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Bar Harel


Bar Harel  added the comment:

> That was true in 2011 and it is still true today

Python's methodology greatly shifted since 2011. For the better or worse, 
Python lost some of its duck typing. Nowadays, most people use linters. 
Wherever you'd try to pass sre_parse.SubPattern, the linter will throw an error 
saying it's not a Sequence even if it fully behaves like one. You can silence 
that error but you'll continue receiving such warnings all over the code, 
whether in stdlib or out in the wild. The meaning of Sequence now shifted to 
"inherits from abc.Sequence". The only thing wrong with PySequence_Check is 
that the ecosystem shifted, but its view of a Sequence remained the same.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Bar Harel


Bar Harel  added the comment:

@rhettinger I completely understand what you're saying and at first I agreed 
with you. Before I gave it a closer look, I thought about the same thing - we 
want reliability. Reliability is important and will avoid subtle bugs, which is 
why I was against this change for the exact reasons you mentioned: it is both 
breaking and unreliable.

I then realized that this change can be a reliable replacement for 
isinstance(obj, collections.abc.Sequence) at the C level. Let's use the broken 
sre_parse.SubPattern as an example - it does not register or inherit from 
collections.abc.Sequence, and isinstance(SubPattern, collections.abc.Sequence) 
== False. We cannot know programmatically if SubPattern is a Sequence, we 
cannot type hint it as such, and apart from reading the documentation, we 
cannot deal with the type differently in dynamic code that accepts either 
sequences or mappings. I dare to say, counting on it being a sequence, 
especially on a LBYL language like C is even less reliable. While SubPattern 
"embraces" the spirit of duck typing, it is very hard to fit in light of all 
recent changes advocating for a more structured and well defined types. After 
all, this feature was requested in order to solve reliability issues in 
statically typed languages.

Putting everything aside, the grand question still remains: do you think that 
there's a use for an efficient C-API isinstance check for Sequences and 
Mappings? I would presume the answer is yes. Would we encourage it? I have no 
clue. But if there's a need, we can either change this function as it has the 
same "spirit" or introduce a new one to prevent breaking existing code.

To answer your question: per specification, testing for Py_TPFLAGS_SEQUENCE 
using PyType_HasFeature, does not take strings, bytes and bytearray into 
consideration, and will not suffice. It is an incorrect solution that is even 
less reliable and falls into the exact pitfall of "guesswork" (for example 
SubPattern currently doesn't work with it either). It is not encouraged or 
easily thought of. PySequence_Check which is much more intuitive yet doesn't 
work either and that's where fixing it can have an edge.

A theoretical `PyIsInstance_Sequence` can check for TPFLAGS_SEQUENCE and 
Str/Bytes/ByteArray_Check. If I'm not wrong, doing so will be 100% reliable, 
identical to isinstance(obj, Sequence), and will be very efficient.

As a side-note, the C-API documentation for TP_FLAGS is not clear atm. It 
mentions for example tp_as_sequence and says "if such a flag bit is clear, the 
type fields it guards must not be accessed and must be considered to have a 
zero or NULL value instead" yet Py_TPFLAGS_SEQUENCE does not actually coincide 
with sequences per specification. I know it has a different explanation as well 
and the flag has its own docstring, but it is still a bit misleading.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Aviram


Aviram  added the comment:

I agree that a developer should and would prefer the `Py_TPFLAGS_*` but when 
you visit https://docs.python.org/3/c-api/sequence.html
It seems like the best practice to determine Sequence protocol is by using this 
function, hence leading to confusion. There's no recommendation to use the new 
`Py_TPFLAGS_*`.
To have this knowledge of `Py_TPFLAGS_*` one should be very knowledgable in 
Python's C-API.
How about adding a deprecation note to `PyMapping_Check` & `PySequence_Check` 
in the documentation, suggesting the alternative path (to use 
`PyType_HasFeature`)?

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Here's question to focus on:  In what circumstances should a developer ever 
prefer PyMapping_Check() over PyType_HasFeature() with Py_TPFLAGS_MAPPING?

The latter doesn't give any new, useful information:

   return o && Py_TYPE(o)->tp_as_mapping &&
   Py_TYPE(o)->tp_as_mapping->mp_subscript;

I don't see any reason to build on top of this. It's best to just let it go 
gently into the good night without disrupting anything that currently happens 
to work.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> what about simply excluding TPFLAGS_MAPPING from PySequence 
> and TPFLAGS_Sequence from PyMapping? It will remove the types 
> that are 100% not sequences or mappings, as these flags 
> are mutually exclusive by definition.

This is more plausible than the proposed breaking change.


> The result will be much more accurate

If they can't be made fully reliable, why would we ever recommend that someone 
use these functions in real code?  They can be made to guess better than they 
guess now, but there is still guesswork.  

ISTM developers should follow the structure pattern matching implementation and 
refuse the temptation to guess.  If a class declares itself as a mapping or 
sequence, that is reliable information.  In contrast, these functions attempt 
to divine meaning in the absence of a clear declaration.  Using these functions 
will likely result in subtle bugs.

Once Py_TPFLAGS_MAPPING and Py_TPFLAGS_SEQUENCE became available, we should 
have deprecated these functions.  No one should use them anymore. Their core 
design is flawed; they tried to deduce semantics from structural artifacts.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread John Millikin


Change by John Millikin :


--
nosy:  -jmillikin

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Bar Harel


Bar Harel  added the comment:

I thought about it, what about simply excluding TPFLAGS_MAPPING from PySequence 
and TPFLAGS_Sequence from PyMapping? It will remove the types that are 100% not 
sequences or mappings, as these flags are mutually exclusive by definition. The 
result will be much more accurate, yet not cause a breaking change, apart from 
places where it is truly not a sequence or mapping.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Inada Naoki


Inada Naoki  added the comment:

collections.abc.Mapping is fixed by https://bugs.python.org/issue43977
We can be same thing if backward compatibility allows it.

--
nosy: +methane

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

s/it isn't work breaking other things/it isn't worth breaking other things/

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> It changes behavior for objects not being iterable/sequences 
> if not inheriting from `abc.collections.Sequence`.

This would be a breaking change (for example, it broke the long stable 
sre_parse code).

The utility of PySequence_Check and PyMapping_Check is already so low that it 
isn't work breaking other things to just to marginally improve these two minor 
and rarely used functions.

These functions will never be fully reliable.  The documentation explains that 
in general, we can't tell if a class with __getitem__ is a mapping or a 
sequence.  Sometimes hints are present (such as the tp_flags), but the can't 
get a reliable result.  As Guido observed, "calling PyMapping_Check() was never 
particularly reliable, and extension modules depending on it probably always 
had subtle bugs."  That was true in 2011 and it is still true today.

I recommend closing this.  These functions are mostly unimportant and 
unreliable and cannot be made correct.  In contrast, iterability is important 
and needs to be stable.  Special cases aren't important enough to break the 
rules.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Bar Harel


Bar Harel  added the comment:

Another question we should ask is about duck typing. Is a sequence which 
doesn't inherit from abc.Sequence considered a sequence? Whatever the answer 
is, PySequence specifically looks for a sequence and removes duck typing out of 
the picture. The object will not pass static typing and will not pass 
isinstance check, so there's no reason for it to pass PySequence.

--

___
Python tracker 

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Aviram


Aviram  added the comment:

I submitted a draft patch. Using TPFlags alone doesn't cut it as some types are 
excluded (bytes, str, bytearray) in sequence and same for mapping. I'm thinking 
of checking for those cases specifically as those are very very specific 
casings. Would love some input.

--

___
Python tracker 

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



  1   2   3   4   5   6   7   8   9   10   >