[issue2462] python.exe slowing my system

2008-03-23 Thread ryan

New submission from ryan <[EMAIL PROTECTED]>:

Hello!
First of all, i'm not a programmer. I'm running Windows XP Pro. For the
past two/three weeks, every once in a while, my machine runs extremely
slow, and the only strange thing i see in the task manager is a
python.exe. When i stop that process, my machine runs fine again. It's
using 112,000k of memory...i don't know what python is or does, all i
have been able to ascertain is that when it runs, it slows down my
machine. please make it stop. i'm guessing that i'm running an earlier
version of Python, as my computer is older, i'm guessing it's version
2.1.2,2.2, or 2.2.1. I'd really like to trash all python files, yet they
must be in my machine for a reason.  Thank you, in advance.

--
messages: 64357
nosy: FireSnake
severity: normal
status: open
title: python.exe slowing my system

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2462>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2463] python.exe slowing my system

2008-03-23 Thread ryan

New submission from ryan <[EMAIL PROTECTED]>:

Hello!
First of all, I'm nor a programmer. 
Running WinXPpro.
Python.exe runs, using 112,000k mem, according to task manager. 
This problem started about 3 weeks ago, have had machine for 3 years
without issues like this. 
Please help me make this problem go away. 
How do i figure out which program is using python, do i even need python
on my machine?
Thank you in advance.

--
messages: 64361
nosy: FireSnake
severity: normal
status: open
title: python.exe slowing my system

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2463>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2462] python.exe slowing my system

2008-03-23 Thread ryan

ryan <[EMAIL PROTECTED]> added the comment:

Dear Mr Peterson:

The FAQ did help somewhat...i figured that it was some 3rd party app, yet i 
have not downloaded any new programming recently, and it seems that python.exe 
runs when it wants to, unrelated to a unique program that i use rarely. 

I did receive a new Java update as well as a new version of spybot, which 
included teatimer, that is all. 

thank you for your input, all the FAQs at different websites merely informed me 
of what python was, not what programs use it. 

Ryan

-
Never miss a thing.   Make Yahoo your homepage.

Added file: http://bugs.python.org/file9836/unnamed

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2462>
__Dear Mr Peterson:The FAQ did help somewhat...i figured that it was some 
3rd party app, yet i have not downloaded any new programming recently, and it 
seems that python.exe runs when it wants to, unrelated to a unique program that 
i use rarely. I did receive a new Java update as well as a new version 
of spybot, which included teatimer, that is all. thank you for your 
input, all the FAQs at different websites merely informed me of what python 
was, not what programs use it. Ryan  

  Never miss a thing.  http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs";> Make Yahoo 
your homepage.___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39292] syslog constants behind rfc

2020-01-10 Thread Ryan


New submission from Ryan :

When using the SysLogHandler 
(https://docs.python.org/3/library/logging.handlers.html#logging.handlers.SysLogHandler)
 the supported facilities appear to be lagging the RFC (5454 ?), or at least 
what is being supported in other mainstream languages. I Specifically need 
LOG_AUDIT and LOG_NTP but there are a couple others. The syslog "openlog" 
function takes an INT but not sure how to get an INT through the python 
SysLogHandler because it's based on a static list of names and symbolic values.
Wikipedia (https://en.wikipedia.org/wiki/Syslog#Facility) suggests LOG_AUTH and 
LOG_NTP are in the RFC. 
This is my first ticket here so hopefully this is the right place for it. Maybe 
there is a workaround or some re-education needed on my part...

--
components: Library (Lib)
messages: 359746
nosy: tryanunderw...@gmail.com
priority: normal
severity: normal
status: open
title: syslog constants behind rfc
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue39292] syslog constants behind rfc

2020-01-11 Thread Ryan


Ryan  added the comment:

Thank you, this looks good. I'm pinned to 3.6 so while it won't work for me 
currently, maybe it will in a few years.
For clarity and because I can't edit my original message, the RFC is 5424 (I 
had mistakenly said 5454 but you got it right).

--

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



[issue36646] os.listdir() got permission error in Python3.6 but it's fine in Python2.7

2019-04-16 Thread Ryan


New submission from Ryan :

My script need scan a netdisk directory to get the content of it. I use 
os.listdir() method for an easy implement, then I got permission error when 
executing in Python 3.x, but the same code is working fine in Python 2.7,I 
attached a screenshot for explaining the problem.

--
components: Windows
files: X1ONx.png
messages: 340373
nosy: rya...@163.com, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.listdir() got permission error in Python3.6 but it's fine in Python2.7
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48269/X1ONx.png

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



[issue36646] os.listdir() got permission error in Python3.6 but it's fine in Python2.7

2019-04-16 Thread Ryan

Ryan  added the comment:

Hi Steven,
Thanks for your reply, I paste the output I executed just now as below.
You can see that the both version of Python are running in the same shell with 
the same permission. And the frequency of this problem is always happen. BTW, 
the network disk is an intranet path of our company, we have the read 
permission of it.

PS D:\workspace> python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir(r'L:\Temp')
['manager.txt', 'alps-trunk-m0.tk.log', '2015102914.LOG', 'log', 
'alps-trunk-m0.tk-k55mv1_64_om_c2k6m_eng-2015111215.LOG
', 'logof', '1', 'dsp_1_ltg_n.bin', 'dsp_1_lwg_n.bin', 'modem_1_ltg_n.img', 
'modem_1_lwg_n.img', 'kernel_symbols', 'k55v
1_64_om_c2k6m_clang.log', 'k55v1_64_om_c2k6m_android.log', 
'k50v1_64_om_c2k6m_android.log', 'collectBuildLog.sh', 'Utili
tySpotlight', 'k55v1_bsp_android.log', 'specialowner.pm', 'DBbuild_GIT.pl', 
'daily_out-k37mv1_basic', 'mtkall_new.txt',
'Visa', 'insert_err_command_file.txt', 'test', 'DB_X_remake.list', 
'aosp_img.txt', 'Jola', '04272', 'alps_dailybuild.ini
', 'Luca', 'android-security-bulletin', 'michael', '2018073115.LOG', 'LOG~1', 
'mtk-db.pl', 'MCD_k79v1_64_android.log', '
build-full_k79v1_64.ninja']
>>> exit()
PS D:\workspace> python3
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir(r'L:\Temp')
Traceback (most recent call last):
  File "", line 1, in 
PermissionError: [WinError 5] 拒绝访问。: 'L:\\Temp'
>>> exit()
PS D:\workspace>

--

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



[issue36646] os.listdir() got permission error in Python3.6 but it's fine in Python2.7

2019-04-16 Thread Ryan

Ryan  added the comment:

Hi Steven,
> PermissionError: [WinError 5] 拒绝访问。: 'L:\\Temp'
to EN
> PermissionError: [WinError 5] Access denied.: 'L:\\Temp'

--

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



[issue36646] os.listdir() got permission error in Python3.6 but it's fine in Python2.7

2019-04-17 Thread Ryan


Ryan  added the comment:

I ran "python3" because I rename the execute file for distincting with python2 
exe.
PS D:\workspace> (get-command python3).source
C:\Python36_64\python3.exe

There is no problem for my dev environment, it's an obviously different output 
for the same API call between python2.7 and python3.6.
not only listdir(), but also os.walk() has the same problem.

--

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



[issue36646] os.listdir() got permission error in Python3.6 but it's fine in Python2.7

2019-04-17 Thread Ryan


Ryan  added the comment:

PS D:\workspace> python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir(u'L:\\Temp')
[u'manager.txt', u'alps-trunk-m0.tk.log', u'2015102914.LOG', u'log', 
u'alps-trunk-m0.tk-k55mv1_64_om_c2k6m_eng-201511121
5.LOG', u'logof', u'1', u'dsp_1_ltg_n.bin', u'dsp_1_lwg_n.bin', 
u'modem_1_ltg_n.img', u'modem_1_lwg_n.img', u'kernel_sym
bols', u'k55v1_64_om_c2k6m_clang.log', u'k55v1_64_om_c2k6m_android.log', 
u'k50v1_64_om_c2k6m_android.log', u'collectBuil
dLog.sh', u'UtilitySpotlight', u'k55v1_bsp_android.log', u'specialowner.pm', 
u'DBbuild_GIT.pl', u'daily_out-k37mv1_basic
', u'mtkall_new.txt', u'Visa', u'insert_err_command_file.txt', u'test', 
u'DB_X_remake.list', u'aosp_img.txt', u'Jola', u
'04272', u'alps_dailybuild.ini', u'Luca', u'android-security-bulletin', 
u'michael', u'2018073115.LOG', u'LOG~1', u'mtk-d
b.pl', u'MCD_k79v1_64_android.log', u'build-full_k79v1_64.ninja']
>>> exit()
PS D:\workspace>
PS D:\workspace>
PS D:\workspace> python3
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir(u'L:\\Temp')
Traceback (most recent call last):
  File "", line 1, in 
PermissionError: [WinError 5] Access denied.: 'L:\\Temp'
>>> exit()
PS D:\workspace>

--

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



[issue34029] tkinter.filedialog.askdirectory() crashing before dialog opens

2018-07-03 Thread Ryan


Change by Ryan :


--
nosy: +serhiy.storchaka

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



[issue34029] tkinter.filedialog.askdirectory() crashing before dialog opens

2018-07-03 Thread Ryan


New submission from Ryan :

I'm creating a GUI application that needs to give the user the option to change 
a folder that's used for saving data.

I managed to track it down to the import of pywinauto to the application. All 
other filedialogs seem to work, it's only askdirectory that's having issues.

I've attached a small file that shows the crash - if you comment out the 
pywinauto import, no crash occurs.

--
components: Tkinter
messages: 320949
nosy: gpolo, rsteel1
priority: normal
severity: normal
status: open
title: tkinter.filedialog.askdirectory() crashing before dialog opens
type: crash
versions: Python 3.6

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



[issue34029] tkinter.filedialog.askdirectory() crashing before dialog opens when importing pywinauto

2018-07-03 Thread Ryan


Change by Ryan :


--
title: tkinter.filedialog.askdirectory() crashing before dialog opens -> 
tkinter.filedialog.askdirectory() crashing before dialog opens when importing 
pywinauto

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



[issue34029] tkinter.filedialog.askdirectory() crashing before dialog opens when importing pywinauto

2018-07-03 Thread Ryan


Change by Ryan :


Added file: https://bugs.python.org/file47667/minimal_file.py

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



[issue34029] tkinter.filedialog.askdirectory() crashing before dialog opens when importing pywinauto

2018-07-03 Thread Ryan


Ryan  added the comment:

It seems reinstalling pywinauto has fixed this issue for now - I have no idea 
what could have caused it in the first place though.

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

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



[issue34029] tkinter.filedialog.askdirectory() crashing before dialog opens when importing pywinauto

2018-07-03 Thread Ryan


Ryan  added the comment:

Okay so I'm an idiot and forgot that I'd commented out the pywinauto import in 
one of my project files, which is how I found out that was the issue in the 
first place. 

Crash is still occurring after a pywinauto reinstall.

--
status: closed -> open

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



[issue19622] Default buffering for input and output pipes in subprocess module

2014-10-01 Thread Ryan

Ryan added the comment:

This is not fixed. The documentation may be more correct now, but the behavior 
still does not match Python 2 as purported.

The default bufsize changed in 3.3.1 is incorrect, at least when tested in 
3.4.0 and 3.4.1.

Here is a test for systems with cat available.

import subprocess
proc = subprocess.Popen('cat', stdin=subprocess.PIPE)
proc.stdin.write('test\n'.encode('utf8'))

This test will succeed in Python 2.x and Python 3.0 - 3.3.0, but fail on 3.4.x. 
This is a regression as the documentation states "did not match the behavior of 
Python 2 as most code expected", while the current behavior definitely does not 
match Python 2.

--
nosy: +lunixbochs
versions:  -Python 3.2

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



[issue28960] Small typo in Thread.join docs

2016-12-13 Thread Ryan

New submission from Ryan:

There is a '--' before a ',' that doesn't make sense here: 
https://docs.python.org/3/library/threading.html#threading.Thread.join

--
assignee: docs@python
components: Documentation
files: fixdoc.patch
keywords: patch
messages: 283101
nosy: docs@python, rcorre
priority: normal
severity: normal
status: open
title: Small typo in Thread.join docs
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45875/fixdoc.patch

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



[issue28960] Small typo in Thread.join docs

2016-12-14 Thread Ryan

Ryan added the comment:

Removing the comma instead of the double-dash

--
Added file: http://bugs.python.org/file45898/fixdoc2.patch

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



[issue24152] test_mailcap fails

2015-05-09 Thread ryan

New submission from ryan:

UnicodeDecodeError

--
components: Tests
files: results
hgrepos: 308
messages: 242840
nosy: petrosr2
priority: normal
severity: normal
status: open
title: test_mailcap fails
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file39330/results

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



[issue24152] test_mailcap fails

2015-05-09 Thread ryan

ryan added the comment:

running command over PuTTY on Ubuntu 3.13, python 2.7.6

$ ./python -m test test_mailcap

[1/1] test_mailcap
test test_mailcap failed -- Traceback (most recent call last):
  File "/home/petrosr2/Documents/opensource/cpy/Lib/test/test_mailcap.py", line 
126, in test_system_mailcap
caps = mailcap.getcaps()
  File "/home/petrosr2/Documents/opensource/cpy/Lib/mailcap.py", line 26, in 
getcaps
morecaps = readmailcapfile(fp)
  File "/home/petrosr2/Documents/opensource/cpy/Lib/mailcap.py", line 64, in 
readmailcapfile
line = fp.readline()
  File "/home/petrosr2/Documents/opensource/cpy/Lib/encodings/ascii.py", line 
26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3820: 
ordinal not in range(128)

1 test failed:
test_mailcap

--

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



[issue26577] inspect.getclosurevars returns incorrect variable when using class member with the same name as other variable

2021-12-18 Thread Ryan Fox


Ryan Fox  added the comment:

If you change the class member 'x' to a different name like 'y', then cv
doesn't include 'x', but does include an unbound 'y'.

In both cases, the function isn't referring to a global variable, just the
class member of that name. Besides the function itself, no other globals
are included in cv.globals.

On Sat, Dec 18, 2021 at 10:34 AM hongweipeng  wrote:

>
> hongweipeng  added the comment:
>
> Why is expected that 'x' would not exist in cv.globals? I think it works
> normally, you can see `x` in `func.__globals__`.
>
> --
> nosy: +hongweipeng
>
> ___
> Python tracker 
> <https://bugs.python.org/issue26577>
> ___
>

--

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



[issue1093] product function patch

2007-09-02 Thread Ryan Freckleton

New submission from Ryan Freckleton:

This is a patch to implement a product() builtin function. It works
behaves similarly to reduce(operator.mul,...) but is implemented in C.

Tests and documentation are included in this patch.

--
components: Documentation, Library (Lib), Tests
files: product_function.diff
messages: 55599
nosy: ryan.freckleton
severity: normal
status: open
title: product function patch
type: behavior
versions: Python 2.6

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1093>
__Index: Python/bltinmodule.c
===
--- Python/bltinmodule.c	(revision 57913)
+++ Python/bltinmodule.c	(working copy)
@@ -2094,7 +2094,59 @@
 of parameter 'start' (which defaults to 0).  When the sequence is\n\
 empty, returns start.");
 
+static PyObject*
+builtin_product(PyObject *self, PyObject *args)
+{
+	PyObject *seq;
+	PyObject *result = NULL;
+	PyObject *temp, *item, *iter;
 
+	if (!PyArg_UnpackTuple(args, "product", 1, 2, &seq, &result))
+		return NULL;
+
+	iter = PyObject_GetIter(seq);
+	if (iter == NULL)
+		return NULL;
+
+	if (result == NULL) {
+		result = PyInt_FromLong(1);
+		if (result == NULL) {
+			Py_DECREF(iter);
+			return NULL;
+		}
+	} else {
+		Py_INCREF(result);
+	}
+
+	for(;;) {
+		item = PyIter_Next(iter);
+		if (item == NULL) {
+			/* error, or end-of-sequence */
+			if (PyErr_Occurred()) {
+Py_DECREF(result);
+result = NULL;
+			}
+			break;
+		}
+		temp = PyNumber_Multiply(result, item);
+		Py_DECREF(result);
+		Py_DECREF(item);
+		result = temp;
+		if (result == NULL)
+			break;
+	}
+	Py_DECREF(iter);
+	return result;
+}
+
+PyDoc_STRVAR(product_doc,
+"product(sequence[, start]) -> value\n\
+\n\
+Returns the product of a sequence of numbers times the value\n\
+of parameter 'start' (which defaults to 1).  When the sequence is\n\
+empty, returns start.");
+
+
 static PyObject *
 builtin_isinstance(PyObject *self, PyObject *args)
 {
@@ -2296,6 +2348,7 @@
  	{"open",	(PyCFunction)builtin_open,   METH_VARARGS | METH_KEYWORDS, open_doc},
  	{"ord",		builtin_ord,METH_O, ord_doc},
  	{"pow",		builtin_pow,METH_VARARGS, pow_doc},
+ 	{"product",	builtin_product,METH_VARARGS, product_doc},
  	{"range",	builtin_range,  METH_VARARGS, range_doc},
  	{"raw_input",	builtin_raw_input,  METH_VARARGS, raw_input_doc},
  	{"reduce",	builtin_reduce, METH_VARARGS, reduce_doc},
Index: Doc/library/functions.rst
===
--- Doc/library/functions.rst	(revision 57913)
+++ Doc/library/functions.rst	(working copy)
@@ -1104,7 +1104,15 @@
 
.. versionadded:: 2.3
 
+.. function:: product(iterable[, start])
+   Multiplies *start* and the items of an *iterable* from left to right and
+   returns the product. *start* defaults to ``1``. The *iterable*'s items are
+   normally numbers. Note that ``product(range(n), m)`` is equivalent to
+   ``reduce(operator.mul, range(n), m)``
 
+   .. versionadded:: 2.6
+
+
 .. function:: super(type[, object-or-type])
 
Return the superclass of *type*.  If the second argument is omitted the super
Index: Lib/test/test_builtin.py
===
--- Lib/test/test_builtin.py	(revision 57913)
+++ Lib/test/test_builtin.py	(working copy)
@@ -1697,6 +1697,19 @@
 raise ValueError
 self.assertRaises(ValueError, sum, BadSeq())
 
+def test_product(self):
+self.assertEqual(product([]), 1)
+self.assertEqual(product(range(2,8)), 5040)
+self.assertEqual(product(iter(range(2,8))), 5040)
+
+self.assertRaises(TypeError, product)
+self.assertRaises(TypeError, product, 42)
+self.assertRaises(TypeError, product, ['a', 'b', 'c'])
+self.assertRaises(TypeError, product, ['a', 'b', 'c'], '')
+self.assertRaises(TypeError, product, [[1], [2], [3]])
+self.assertRaises(TypeError, product, [{2:3}])
+self.assertRaises(TypeError, product, [{2:3}]*2, {2:3})
+
 def test_tuple(self):
 self.assertEqual(tuple(()), ())
 t0_3 = (0, 1, 2, 3)
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13591] import_module potentially imports a module twice

2011-12-12 Thread Ryan Twitchell

New submission from Ryan Twitchell :

Use of importlib's import_module function with modules belonging to a library
can cause some modules to be imported twice, if such a module is referenced
from sibling modules, and from __init__ in the package.  I suspect this is a
bug, or at best a nuance of packages that is quite subtle.

Easier to show with an example.  Below, the module my_lib.bar will be imported
twice.  Given the following file structure:

./scratch.py
./my_lib/__init__.py
./my_lib/foo.py
./my_lib/bar.py

And the following file contents:

./scratch.py:

import importlib
importlib.import_module('my_lib.bar')
importlib.import_module('my_lib.foo')


./my_lib/__init__.py:

import my_lib.bar

# Or alternately
#from . import bar


./my_lib/foo.py:

from . import bar

print('In foo, id(bar.baz): %s' % id(bar.baz))


./my_lib/bar.py:

def baz():
pass

print('In bar, id(bar.baz): %s' % id(baz))


Running scratch.py results in my_lib.bar being imported twice:
$ echo $PYTHONPATH
.
$ python --version
Python 3.2.2
$ python ./scratch.py
In bar, id(bar.baz): 21328632
In bar, id(bar.baz): 21352240
In foo, id(bar.baz): 21352240


Replacing the calls to import_module with use of the import statement, or
__import__, or simply rearranging the order of the two calls all result in the
module my_lib.bar to be imported only once.  As does eliminating the import
statement in my_lib.__init__.

This may be a misunderstanding on my part regarding the intended use of
packages, but this behavior was quite unexpected, and rather difficult to track
down in real code.

--
components: Library (Lib)
messages: 149358
nosy: Ryan.Twitchell
priority: normal
severity: normal
status: open
title: import_module potentially imports a module twice
type: behavior
versions: Python 3.2

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



[issue13591] import_module potentially imports a module twice

2011-12-13 Thread Ryan Twitchell

Ryan Twitchell  added the comment:

Confirmed that this patch fixes the behavior shown in my original example, with 
3.2.

--

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



[issue12269] Crashes on start

2011-06-05 Thread Ryan Hollis

New submission from Ryan Hollis :

Mac OSX Snow Leopard, Python 2.7, 
The moment I paste anything into the editor window, it crashes. Also IDLE 
crashes within a minute or two of opening, wether or not I actually do anything 
with it after opening it.
uninstalled and reinstalled, didnt help

--
messages: 137724
nosy: Ryan.Hollis
priority: normal
severity: normal
status: open
title: Crashes on start

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



[issue7511] msvc9compiler.py: ValueError: [u'path']

2011-06-06 Thread Ryan Seto

Changes by Ryan Seto :


--
nosy:  -MrWerewolf

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



[issue12483] CThunkObject_dealloc should call PyObject_GC_UnTrack?

2011-07-03 Thread Ryan Kelly

New submission from Ryan Kelly :

According to the docs here:

  http://docs.python.org/c-api/gcsupport.html

Any object that uses PyObject_GC_Track in its constructor must call 
PyObject_GC_UnTrack in its deallocator.  The CThunkObject in _ctypes does the 
former but not the later.  Attached patch adds a call to PyObject_GC_UnTrack.

This doesn't fix any particular bug I was seeing, I just happened to be going 
through the _ctypes sources (you know, for fun...) and noticed this discrepancy.

--
components: ctypes
files: ctypes_gcuntrack.patch
keywords: patch
messages: 139724
nosy: rfk
priority: normal
severity: normal
status: open
title: CThunkObject_dealloc should call PyObject_GC_UnTrack?
versions: Python 3.3
Added file: http://bugs.python.org/file22560/ctypes_gcuntrack.patch

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



[issue11682] PEP 380 reference implementation for 3.3

2011-08-22 Thread Ryan Kelly

Changes by Ryan Kelly :


--
nosy: +rfk

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



[issue11816] Refactor the dis module to provide better building blocks for bytecode analysis

2011-08-22 Thread Ryan Kelly

Changes by Ryan Kelly :


--
nosy: +rfk

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



[issue9957] SpooledTemporayFile.truncate should take size parameter

2010-09-26 Thread Ryan Kelly

New submission from Ryan Kelly :

Both file.truncate() and StringIO.truncate() accept an optional "size" 
parameter to truncate the file to a specific size.  SpooledTemporaryFile should 
accept a similar parameter and pass it on.

The only tricky part is that truncate can potentially increase the size of a 
file, so it needs to check the max size and rollover if appropriate.

Patch is against py3k branch; should work on trunk modulo the use of b"xxx" in 
the tests.

--
components: Library (Lib)
files: spooledtemporaryfile_truncate.patch
keywords: patch
messages: 117436
nosy: rfk
priority: normal
severity: normal
status: open
title: SpooledTemporayFile.truncate should take size parameter
type: behavior
Added file: http://bugs.python.org/file19027/spooledtemporaryfile_truncate.patch

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



[issue9957] SpooledTemporayFile.truncate should take size parameter

2010-09-27 Thread Ryan Kelly

Ryan Kelly  added the comment:

I went looking for places to update the documentation but the description of 
SpooledTemporaryFile doesn't go into any detail of its methods, so I haven't 
added anything.  New patch fixes some whitespace issues.

I'd like to argue that this is a bug, since SpooledTemporaryFile is documented 
as "operates exactly as TemporaryFile() does", and TemporaryFile.truncate 
accepts a "size" parameter.

--
Added file: http://bugs.python.org/file19032/spooledtemporaryfile_truncate.patch

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



[issue9957] SpooledTemporayFile.truncate should take size parameter

2010-09-27 Thread Ryan Kelly

Changes by Ryan Kelly :


Removed file: 
http://bugs.python.org/file19027/spooledtemporaryfile_truncate.patch

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



[issue7511] msvc9compiler.py: ValueError: [u'path']

2010-09-28 Thread Ryan Seto

Ryan Seto  added the comment:

I came across this issue while trying to install mercurial using easy_install. 
I applied the vcvars4.diff to my distutils and this solved the problem.


Environment:

Python 2.6.6 (64 bit)

setuptools-0.6c11.tar.gz
installed using the following instructions:
http://stackoverflow.com/questions/309412/how-to-setup-setuptools-for-python-2-6-on-windows

pywin32-214.win-amd64-py2.6 (installed binaries)
py2exe-0.6.9.win64-py2.6.amd64 (installed binaries)


Windows 7 (64 bit)
Visual Studio Team System 2008 (installed everything)
Visual Studio 2008 SDK 1.1 (installed everything)

--
nosy: +MrWerewolf

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-09-29 Thread Ryan Tucker

Changes by Ryan Tucker :


--
nosy: +Ryan.Tucker

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



[issue8728] 2.7 regression in httplib.py: AttributeError: 'NoneType' object has no attribute 'makefile'

2011-02-28 Thread Ryan Coyner

Changes by Ryan Coyner :


--
nosy: +rcoyner

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



[issue5091] Segfault in PyObject_Malloc(), address out of bounds

2011-03-05 Thread Ryan Kelly

Ryan Kelly  added the comment:

Not sure if it's caused by the same thing, but I just got a segfault on the 
same line in my own program.  Running python 2.7.1.

I will try to dig out some more useful info but it's been a long time since I 
chased a segfault...

--
nosy: +rfk
status: pending -> open

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



[issue5091] Segfault in PyObject_Malloc(), address out of bounds

2011-03-05 Thread Ryan Kelly

Ryan Kelly  added the comment:

Please remind me how to obtain an appropriate coredump (as I said, it's been a 
*long* time...)

Doing "print bp" shows an out-of-bounds address as for the original submitter.

--

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



[issue5091] Segfault in PyObject_Malloc(), address out of bounds

2011-03-05 Thread Ryan Kelly

Ryan Kelly  added the comment:

attaching core dump from a freshly-compiled python 2.7.1 at with "-O0 -g" in 
CFLAGS.

The code that is segfaulting is using pycrypto and sqlite3, so it may be that a 
bug in one of these is trampling on something.  No idea how to investigate any 
further.

--
Added file: http://bugs.python.org/file21004/core.27778.bz2

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



[issue5091] Segfault in PyObject_Malloc(), address out of bounds

2011-03-06 Thread Ryan Kelly

Ryan Kelly  added the comment:

Thanks for the help, I have tracked this down to a bug in PyCrypto.  It was 
increfing an object once but decrefing it twice.

Sorry for the noise.

--

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



[issue11448] docs for HTTPConnection.set_tunnel are ambiguous

2011-03-08 Thread Ryan Kelly

New submission from Ryan Kelly :

The docs for HTTPConnection.set_tunnel(host,port) are ambiguous.  They simply 
say "Set the host and the port for HTTP Connect Tunnelling".  But should I 
specify the address of the server *through* which I want to tunnel, or the 
address of the *endpoint* of the tunnel?

Turns out it's the latter, but I just wasted an hour "debugging" thinking it 
was the former :-(

Attached is a simple doc patch to try to clarify this issue.

--
assignee: docs@python
components: Documentation
files: set_tunnel_doc.diff
keywords: patch
messages: 130396
nosy: docs@python, rfk
priority: normal
severity: normal
status: open
title: docs for HTTPConnection.set_tunnel are ambiguous
versions: Python 3.3
Added file: http://bugs.python.org/file21056/set_tunnel_doc.diff

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



[issue11448] docs for HTTPConnection.set_tunnel are ambiguous

2011-03-08 Thread Ryan Kelly

Ryan Kelly  added the comment:

Sorry, "endpoint" is just a noun that seemed to fit for me, I've no idea if 
there is a standard term for this.  Perhaps "origin server" if you follow the 
terminology from the RFC?

By way of example, suppose I'm running a proxy on localhost:3128 and I want to 
tunnel through it to connect to www.example.com:443.

>From the train of thought that "I need to tunnel through localhost:3128 to 
>connect to www.example.com:443" my instinct was to write code like this:

  c = HTTPSConnection("www.example.com",443)
  c.set_tunnel("localhost",3128)
  c.send('...etc...')

This doesn't work; it tries to tunnel through www.example.com to get to 
localhost.  The correct way around is:

  c = HTTPSConnection("localhost",3128)
  c.set_tunnel("www.example.com",443)
  c.send('...etc...')

Another way to put it:  the arguments to set_tunnel are the host/port to tunnel 
*to*, not the host/port to tunnel *through*.

I was only able to work this out by looking through to code for urllib2.  It's 
not clear from the docs.  Then again, sounds like my doc patch didn't make 
things any clearer :-)

--

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



[issue10399] AST Optimization: inlining of function calls

2011-04-12 Thread Ryan Kelly

Changes by Ryan Kelly :


--
nosy: +rfk

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



[issue10590] Parameter type error for xml.sax.parseString(string, ...)

2010-11-30 Thread Thomas Ryan

New submission from Thomas Ryan :

In 3.1.3, 3.1.2, maybe earlier...

xml.sax.parseString(string, handler, error_handler=handler.ErrorHandler())

Source code requires bytes, not a string as implied by function name and by the 
documentation.

Exception thrown for strings.

Since the name includes "string" the source should probably be fixed.
Or at least update the documentation.

Someday replace/augment parseString() with parseBytes()?

--
components: XML
messages: 122933
nosy: Thomas.Ryan
priority: normal
severity: normal
status: open
title: Parameter type error for xml.sax.parseString(string, ...)
type: behavior
versions: Python 3.3

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



[issue6538] MatchObject is not a hyperlink in the 're' module documentation

2010-02-20 Thread Ryan Arana

Ryan Arana  added the comment:

Changed all occurrences of :class:`MatchObjects` to :ref:`match-objects` in 
/Doc/library/re.rst

These changes were made to rev 78277.

--
keywords: +patch
nosy: +rarana
Added file: http://bugs.python.org/file16274/MatchObjectLinksFix.diff

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



[issue7162] 2to3 does not convert __builtins__.file

2010-02-27 Thread Ryan Coyner

Ryan Coyner  added the comment:

Patch attached. Unit test and documentation included.

COMMITMSG:

Adds a new fixer to lib2to3 which replaces the deprecated builtin "file" with 
"open".

--
keywords: +patch
nosy: +rcoyner
Added file: http://bugs.python.org/file16392/issue7162.patch

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



[issue6729] Add support for ssize_t

2010-02-28 Thread Ryan Coyner

Ryan Coyner  added the comment:

You don't want to do c_size_t = c_void_p because that will prevent type 
checking. We want c_size_t to be integers; setting it to c_void_p will accept 
other values. The lines that define c_size_t are doing a sizeof check to 
determine how many bits the CPU supports, and c_size_t should represent 
unsigned integers [1].

On a 16-bit machine: c_size_t = c_uint
On a 32-bit machine: c_size_t = c_ulong
On a 64-bit machine: c_size_t = c_ulonglong

Now, ssize_t is like size_t, except that it is signed [2]. So if I am not 
mistaken, all we have to do is:

if sizeof(c_uint) == sizeof(c_void_p):
c_size_t = c_uint
c_ssize_t = c_int
elif sizeof(c_ulong) == sizeof(c_void_p):
c_size_t = c_ulong
c_ssize_t = c_long
elif sizeof(c_ulonglong) == sizeof(c_void_p):
c_size_t = c_ulonglong
c_ssize_t = c_longlong


Patch attached with documentation and unit test.


[1] - 
http://www.gnu.org/software/libc/manual/html_node/Important-Data-Types.html
[2] - http://www.gnu.org/software/libc/manual/html_node/I_002fO-Primitives.html

--
keywords: +patch
nosy: +rcoyner
Added file: http://bugs.python.org/file16405/issue6729.patch

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



[issue5277] email message.get_params() and related methods sometimes fail.

2010-03-03 Thread Ryan Coyner

Ryan Coyner  added the comment:

Okay, bug confirmed:

>>> m = email.message_from_string('Content-Disposition: inline; filename*0="foo 
>>> \\"test"; filename*1="\\"bar"')
>>> m.get_filename()
'foo "test"; filename*1=""bar'


And here is the result with the patch applied:

>>> m = email.message_from_string('Content-Disposition: inline; filename*0="foo 
>>> \\"test"; filename*1="\\"bar"')
>>> m.get_filename()
'foo "test"bar'


Attached a patch. Unit test included.

--
nosy: +rcoyner
Added file: http://bugs.python.org/file16426/issue5277.patch

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



[issue6538] MatchObject is not a hyperlink in the 're' module documentation

2010-03-04 Thread Ryan Arana

Ryan Arana  added the comment:

Added .. class:: MatchObject and .. class:: RegexObject directives.

--
Added file: http://bugs.python.org/file16427/MatchObjectLinksFix.diff

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



[issue7162] 2to3 does not convert __builtins__.file

2010-03-07 Thread Ryan Coyner

Ryan Coyner  added the comment:

I thought the whole point was that file[1] was removed in 3.0[2]? Or, are you 
saying that if somebody overloaded file with def file(...)? If that is the case 
would it be reasonable to check like this?

>>> file in list(__builtins__.__dict__.values())
True
>>> def file():
... pass
... 
>>> file in list(__builtins__.__dict__.values())
False
>>> 


[1] - http://docs.python.org/library/functions.html?highlight=file#file
[2] - http://docs.python.org/3.1/whatsnew/3.0.html#builtins

--

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



[issue6538] MatchObject is not a hyperlink in the 're' module documentation

2010-03-08 Thread Ryan Arana

Changes by Ryan Arana :


Removed file: http://bugs.python.org/file16274/MatchObjectLinksFix.diff

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



[issue6538] MatchObject is not a hyperlink in the 're' module documentation

2010-03-08 Thread Ryan Arana

Ryan Arana  added the comment:

I tried to format the methods of the class(es) as they are formatted in other 
files, which is why I added the whitespace. 

I can go back and remove that if that's what would be preferred.

--

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



[issue3243] Support iterable bodies in httplib

2010-03-10 Thread Ryan Coyner

Ryan Coyner  added the comment:

This patch and its tests still work. Any particular reason why it hasn't been 
adopted yet?

--
nosy: +rcoyner

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



[issue1411695] XML.sax.saxutils.escape -- always escapes <

2008-01-19 Thread Ryan Freckleton

Ryan Freckleton added the comment:

I've included a unified diff that explicitly states the behavior of &,
<, and > for escape/unescape in the documentation. It's based on
msandler's patch.

--
nosy: +ryan.freckleton
Added file: http://bugs.python.org/file9230/sax_utils_rst.patch

_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1411695>
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1411695] XML.sax.saxutils.escape -- always escapes <

2008-01-19 Thread Ryan Freckleton

Changes by Ryan Freckleton:


--
components: +Documentation
versions: +Python 2.6

_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1411695>
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1983] Return from fork() is pid_t, not int

2008-01-31 Thread Ryan Stutsman

New submission from Ryan Stutsman:

In current trunk (60097).  Return from fork is not int but pid_t. 
Treating this as an int causes total breakage on systems with 64-bit pids.

--
components: Library (Lib)
messages: 61926
nosy: stutsman
severity: normal
status: open
title: Return from fork() is pid_t, not int
versions: Python 2.6, Python 3.0

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1983>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1983] Return from fork() is pid_t, not int

2008-01-31 Thread Ryan Stutsman

Ryan Stutsman added the comment:

Yeah; I shuold be able to provide one.  I just hacked 2.4.4 to work so I
think I could provide a fix easily.  The version I put together here is
rough, so I'll try to create a cleaner solution tonight or this weekend.

HiStar does (http://www.scs.stanford.edu/histar/).

Not sure if it's better to test for pid_t (in configure) or just use a
long long value all around a punt the problem?  I'll probably just go
with the former unless there are objections.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1983>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1983] Return from fork() is pid_t, not int

2008-01-31 Thread Ryan Stutsman

Ryan Stutsman added the comment:

> IIUC, HiStar is available in a 32-bit version,
> too, yet it may still use a 64-bit pid_t (Ryan, can
> you confirm whether that's the case?).

Great point.  pid_t is always 64-bit on HiStar.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1983>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1983] Return from fork() is pid_t, not int

2008-02-01 Thread Ryan Stutsman

Ryan Stutsman added the comment:

Actually the current trunk of as of this morning (60484) is still broken
in a couple of ways.  First, converting the pid_t using PyInt is a
problem  and second the waitpids aren't corrected.  This would cause
waits on invalid pids.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1983>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2474] fset not working

2008-03-24 Thread Ryan Sturmer

New submission from Ryan Sturmer <[EMAIL PROTECTED]>:

Using the attached module, There's an asymmetry between fget and fset in
my properties.  fget works fine, but fset isn't getting called.  I'm
fairly sure I'm creating the property correctly.  Try the following code:

a = EWAssayIntParam('myparam', 4)
a.value
a.value = 10
a.value

I've seen this same issue flare up and die out several times in the
tracker, is this a commonly made programming mistake rather than a bug?

--
components: None
files: params.py
messages: 64427
nosy: ryansturmer
severity: normal
status: open
title: fset not working
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file9840/params.py

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2474>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2488] Backport sys.maxsize to Python 2.6

2008-03-25 Thread Ryan Freckleton

Ryan Freckleton <[EMAIL PROTECTED]> added the comment:

Here's a patch including docstring and NEWS update for this backport.

--
keywords: +patch
nosy: +ryan.freckleton
Added file: http://bugs.python.org/file9859/patch.diff

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2488>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4875] find_library can return directories instead of files

2009-01-07 Thread Ryan Kelly

New submission from Ryan Kelly :

On win32, ctypes.util.find_library uses os.path.exists() to check for
potential library files.  This means it is quite happy to return a
directory instead of a file, if one happens to exist with the
appropriate name somewhere in the search path.  Can this please be
changed to use os.path.isfile() instead of os.path.exists()?

--
assignee: theller
components: ctypes
messages: 79385
nosy: rfk, theller
severity: normal
status: open
title: find_library can return directories instead of files
type: behavior
versions: Python 2.6

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



[issue5135] Expose simplegeneric function in functools module

2009-02-03 Thread Ryan Freckleton

Ryan Freckleton  added the comment:

PJE seems to have borrowed the time machine :-). Based on the code the
register function is already a decorator:

def register(typ, func=None):
if func is None:
return lambda f: register(typ, f)
registry[typ] = func
return func

The returned lambda is a one argument decorator. so your syntax:

@generic_fn.register(XXX)
def xxx_impl(xxx):
pass

Already works. A test to validate this behavior should probably be added.

I don't mean to bikeshed, but could we call this function
functools.generic instead of functools.simplegeneric? The only reason I
can think of for keeping it simplegeneric would be to avoid a future
name clash with the Generic Function PEP and if/when that PEP get's
implemented, I would think that the functionality would live in
builtins, not functools.

--
nosy: +ryan.freckleton

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



[issue5135] Expose simplegeneric function in functools module

2009-02-04 Thread Ryan Freckleton

Ryan Freckleton  added the comment:

I think that registering existing functions is an important use case, so
I vote for keeping the non-decorator version of register.

Another thing that we may want to document is that [simple]generic
doesn't dispatch based on registered abstract base classes.

>>> class A:
... pass
...
>>> class C:
... __metaclass__ = abc.ABCMeta
...
>>> C.register(A)
>>> @generic
... def pprint(obj):
... print str(obj)
...
>>> @pprint.register(C)
... def pprint_C(obj):
... print "Charlie", obj
...
>>> pprint(C())
Charlie <__main__.C object at 0xb7c5336c>
>>> pprint(A())
<__main__.A instance at 0xb7c5336c>

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



[issue5205] String Formatting with namedtuple

2009-02-10 Thread Lie Ryan

New submission from Lie Ryan :

I've been experimenting with namedtuple, it seems that string formatting
doesn't recognize namedtuple as mapping. 

from collections import namedtuple
Nt = namedtuple('Nt', ['x', 'y'])
nt = Nt(12, 32)
print 'one = %(x)s, two = %(y)s' % nt

# output should be:
one = 12, two = 32

currently, it is possible to use nt._asdict() as a workaround, but I
think it will be easier and more intuitive to be able to use namedtuple
directly with string interpolation.

I tried this with 2.6 and 2.7a (trunk). Haven't seen 3.0 yet.

PS: Although the following works, it is not the topic of the issue:
print 'one = %s, two = %s' % nt

--
components: Library (Lib)
messages: 81555
nosy: lieryan
severity: normal
status: open
title: String Formatting with namedtuple
type: feature request
versions: Python 2.7

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



[issue5205] String Formatting with namedtuple

2009-02-10 Thread Lie Ryan

Changes by Lie Ryan :


--
components: +Interpreter Core
versions: +Python 2.6

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



[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2019-09-05 Thread Ryan May


Change by Ryan May :


--
nosy: +Ryan May

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



[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2019-09-07 Thread Ryan Hiebert


Change by Ryan Hiebert :


--
nosy: +ryanhiebert

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



[issue31387] asyncio should make it easy to enable cooperative SIGINT handling

2019-09-07 Thread Ryan Hiebert


Change by Ryan Hiebert :


--
nosy: +ryanhiebert

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



[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2019-09-08 Thread Ryan Hiebert


Change by Ryan Hiebert :


--
nosy: +ryanhiebert

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



[issue38217] argparse should support multiple types when nargs > 1

2019-09-18 Thread Ryan Govostes


New submission from Ryan Govostes :

argparse supports consuming multiple command-line arguments with nargs=2, etc. 
It converts them to the type given in the argument's type parameter.

argparse does not provide a good solution when the input arguments should be 
different data types. For an example, you cannot have an argument that expects 
a str followed by an int, '--set-age Bob 34'.

Ordinarily, the suggestion would be to split it into two arguments, like 
'--set-person Bob --set-age 34'.

However, this becomes awkward with an action such as 'append', where the 
command line arguments become tedious, like '--set-person Bob --set-age 34 
--set-person Alice --set-age 29', or confusing, as in '--set-person Bob 
--set-person Alice --set-age 34 --set-age 29'.

My proposal is to allow the 'type' parameter to accept a tuple of types:

p.add_argument('--set-age', nargs=2, type=(str, int))

Since 'nargs' is redundant, this could even be simplified to just:

p.add_argument('--set-age', type=(str, int))

The resulting parsed argument would then be a tuple of (str, int), as opposed 
to a list. If action='append', the result would be a list of such tuples.

This creates no backwards compatibility issue because tuple instances are not 
callable, so this was never valid code that did something else.

A further enhancement could be that when nargs='+' or '*', and a tuple of types 
is provided, the types are used round robin: '--set-ages Bob 34 Alice 29'. An 
exception would be raised if it would create an incomplete tuple.

See here for other discussion and workarounds: 
https://stackoverflow.com/questions/16959101/python-argparse-how-to-have-nargs-2-with-type-str-and-type-int

--
components: Library (Lib)
messages: 352741
nosy: rgov
priority: normal
severity: normal
status: open
title: argparse should support multiple types when nargs > 1
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue33725] Python crashes on macOS after fork with no exec

2019-10-16 Thread Ryan May


Change by Ryan May :


--
nosy: +Ryan May

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



[issue38595] io.BufferedRWPair doc warning may need clarification

2019-10-25 Thread Ryan Govostes


New submission from Ryan Govostes :

The documentation for the io.BufferedRWPair class gives this warning:

> BufferedRWPair does not attempt to synchronize accesses to its underlying raw 
> streams. You should not pass it the same object as reader and writer; use 
> BufferedRandom instead.

I have a hard time understanding what this warning is trying to tell me.

1. What does it mean to "synchronize accesses"?

2. Why can't I pass the same object as reader and writer? The docstring in 
_pyio.py says, "This is typically used with a socket or two-way pipe."

3. How does BufferedRandom, which adds the seek() and tell() interfaces, 
address the issue of "synchroniz[ing] accesses"? Is synchronization automatic? 
What does this do for sockets or pipes which cannot seek?

--
assignee: docs@python
components: Documentation
messages: 355404
nosy: docs@python, rgov
priority: normal
severity: normal
status: open
title: io.BufferedRWPair doc warning may need clarification
type: behavior
versions: Python 3.7

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



[issue38595] io.BufferedRWPair doc warning may need clarification

2019-10-25 Thread Ryan Govostes


Ryan Govostes  added the comment:

The origin of this warning involves interleaving read and write operations, and 
was added here: https://bugs.python.org/issue12213

I'm not sure if it applies to sockets, pipes, etc. though.

The pySerial documentation advises using io.BufferedRWPair(x, x) where x is a 
serial device. But this StackOverflow post reports that it is problematic, in 
line with the warning. (The author appears to be talking about Windows.)

https://stackoverflow.com/questions/24498048/python-io-modules-textiowrapper-or-buffererwpair-functions-are-not-playing-nice

--
nosy: +benjamin.peterson, pitrou, stutzbach

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



[issue29687] smtplib does not support proxy

2021-03-17 Thread Ryan Hiebert


Change by Ryan Hiebert :


--
nosy: +ryanhiebert

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



[issue29687] smtplib does not support proxy

2021-03-17 Thread Ryan Hiebert


Ryan Hiebert  added the comment:

Thank you, Christian. It sounds like you believe that we should view the 
`_get_socket` method as a public interface? That at least makes it possible to 
use a proxy socket through an appropriate mechanism, which solves my use-case.

--

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



[issue43532] Add keyword-only fields to dataclasses

2021-03-17 Thread Ryan Hiebert


Change by Ryan Hiebert :


--
nosy: +ryanhiebert

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



[issue43738] Clarify public name of curses.window

2021-04-05 Thread Ryan McCampbell


New submission from Ryan McCampbell :

Until 3.8 the curses window class was not directly available in code, but now 
it is available as `_curses.window`. This is not explicitly stated in the 
documentation (although it is consistent with how the method signatures are 
written). It is useful to have a public name for the type to aid IDE's with 
explicit type annotations, i.e.

@curses.wrapper
def main(stdscr: curses.window):
stdscr.addstr(...)

See https://github.com/python/typeshed/pull/5180, which adds this name to type 
hints in the typeshed project.

This name should be more clearly documented so programmers can annotate the 
type without worrying that it may change (which will cause a runtime error 
unless it is quoted).

--
assignee: docs@python
components: Documentation
messages: 390266
nosy: docs@python, rmccampbell7
priority: normal
severity: normal
status: open
title: Clarify public name of curses.window
type: enhancement
versions: Python 3.10, Python 3.9

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



[issue43913] unittest module cleanup functions not run unless tearDownModule() is defined

2021-04-22 Thread Ryan Tarpine


New submission from Ryan Tarpine :

Functions registered with unittest.addModuleCleanup are not called unless the 
user defines tearDownModule in their test module.

This behavior is unexpected because functions registered with 
TestCase.addClassCleanup are called even the user doesn't define tearDownClass, 
and similarly with addCleanup/tearDown.

The implementing code is basically the same for all 3 cases, the difference is 
that unittest.TestCase itself defines tearDown and tearDownClass; so even 
though doClassCleanups is only called if tearDownClass is defined, in practice 
it always is.

doModuleCleanups should be called even if tearDownModule is not defined.

--
components: Library (Lib)
messages: 391619
nosy: rtarpine
priority: normal
severity: normal
status: open
title: unittest module cleanup functions not run unless tearDownModule() is 
defined
type: behavior
versions: Python 3.8

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-06 Thread Ryan Hileman


Ryan Hileman  added the comment:

I just ran into this. GetTickCount64() is a bad choice even without improving 
the Windows timer resolution, as every mutex wait will have 16ms of jitter. 
Here are some lock.acquire(timeout=0.001) times measured with 
time.perf_counter():

elapsed=21.215ms
elapsed=30.960ms
elapsed=21.686ms
elapsed=30.998ms
elapsed=30.794ms

Here's the same lock.acquire(timeout=0.001) with CPython patched to use 
QueryPerformanceCounter() instead of GetTickCount64(). Notice this is less 
overhead than even the original post's Python 2.x times.

elapsed=9.554ms
elapsed=14.516ms
elapsed=13.985ms
elapsed=13.434ms
elapsed=13.724ms

Here's the QueryPerformanceCounter() test in a timeBeginPeriod(1) block:

elapsed=1.135ms
elapsed=1.204ms
elapsed=1.189ms
elapsed=1.052ms
elapsed=1.052ms

I'd like to submit a PR to fix the underlying issue by switching to 
QueryPerformanceCounter() in EnterNonRecursiveMutex().

QueryInterruptTime() is a bad candidate because it's only supported on Windows 
10, and CPython still supports Windows 8. Improvements based on 
QueryPerformanceCounter() can be backported to at least 3.8 (3.8 dropped 
Windows XP support, which was the last Windows version where 
QueryPerformanceCounter() could fail).

I checked and the only other use of GetTickCount64() seems to be in 
time.monotonic(). Honestly I would vote to change time.monotonic() to 
QueryPerformanceCounter() as well, as QueryPerformanceCounter() can no longer 
fail on any Windows newer than XP (which is no longer supported by Python), but 
that's probably a topic for a new BPO.

--
nosy: +lunixbochs2
versions:  -Python 3.10, Python 3.9

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-06 Thread Ryan Hileman


Change by Ryan Hileman :


--
versions: +Python 3.10, Python 3.11, Python 3.9

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



[issue44328] time.monotonic() should use QueryPerformanceCounter() on Windows

2021-06-06 Thread Ryan Hileman


New submission from Ryan Hileman :

Related to https://bugs.python.org/issue41299#msg395220

Presumably `time.monotonic()` on Windows historically used GetTickCount64() 
because QueryPerformanceCounter() could fail. However, that hasn't been the 
case since Windows XP: 
https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter

> On systems that run Windows XP or later, the function will always succeed and 
> will thus never return zero

I've run into issues with this when porting python-based applications to 
Windows. On other platforms, time.monotonic() was a decent precision so I used 
it. When I ported to Windows, I had to replace all of my time.monotonic() calls 
with time.perf_counter(). I would pretty much never knowingly call 
time.monotonic() if I knew ahead of time it could be quantized to 16ms.

My opinion is that the GetTickCount64() monotonic time code in CPython should 
be removed entirely and only the QueryPerformanceCounter() path should be used.

I also think some of the failure checks could be removed from 
QueryPerformanceCounter() / QueryPerformanceFrequency(), as they're documented 
to never fail in modern Windows and CPython has been dropping support for older 
versions of Windows, but that's less of a firm opinion.

--
components: Library (Lib), Windows
messages: 395221
nosy: lunixbochs2, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: time.monotonic() should use QueryPerformanceCounter() on Windows
type: performance
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-06 Thread Ryan Hileman


Change by Ryan Hileman :


--
keywords: +patch
pull_requests: +25157
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26568

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-06 Thread Ryan Hileman


Ryan Hileman  added the comment:

Ok, I filed a PR for this. I used pytime's interface to avoid duplicating the 
QueryPerformanceFrequency() code.

I found a StackOverflow answer that says QueryPerformance functions will only 
fail if you pass in an unaligned pointer: https://stackoverflow.com/a/27258700

Per that, I used Py_FatalError to catch this case, as there is probably 
something wrong with the compiler at that point, and the other recovery options 
would be likely to result in incorrect program behavior (e.g. dead lock).

--

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-06 Thread Ryan Hileman


Ryan Hileman  added the comment:

I found these two references:
- 
https://stackoverflow.com/questions/35601880/windows-timing-drift-of-performancecounter-c
- https://bugs.python.org/issue10278#msg143209

Which suggest QueryPerformanceCounter() may be bad because it can drift. 
However, these posts are fairly old and the StackOverflow post also says the 
drift is small on newer hardware / Windows.

Microsoft's current stance is that QueryPerformanceCounter() is good: 
https://docs.microsoft.com/en-us/windows/win32/sysinfo/acquiring-high-resolution-time-stamps

> Guidance for acquiring time stamps
> Windows has and will continue to invest in providing a reliable and efficient 
> performance counter. When you need time stamps with a resolution of 1 
> microsecond or better and you don't need the time stamps to be synchronized 
> to an external time reference, choose QueryPerformanceCounter

I looked into how a few other languages provide monotonic time on Windows:

Golang seems to read the interrupt time (presumably equivalent to 
QueryInterruptTime) directly by address. 
https://github.com/golang/go/blob/a3868028ac8470d1ab7782614707bb90925e7fe3/src/runtime/sys_windows_amd64.s#L499

Rust uses QueryPerformanceCounter: 
https://github.com/rust-lang/rust/blob/38ec87c1885c62ed8c66320ad24c7e535535e4bd/library/std/src/time.rs#L91

V8 uses QueryPerformanceCounter after checking for old CPUs: 
https://github.com/v8/v8/blob/dc712da548c7fb433caed56af9a021d964952728/src/base/platform/time.cc#L672

Ruby uses QueryPerformanceCounter: 
https://github.com/ruby/ruby/blob/44cff500a0ad565952e84935bc98523c36a91b06/win32/win32.c#L4712

C# implements QueryPerformanceCounter on other platforms using CLOCK_MONOTONIC, 
indicating that they should be roughly equivalent: 
https://github.com/dotnet/runtime/blob/01b7e73cd378145264a7cb7a09365b41ed42b240/src/coreclr/pal/src/misc/time.cpp#L175

Swift originally used QueryPerformanceCounter, but switched to 
QueryUnbiasedInterruptTime() because they didn't want to count time the system 
spent asleep: 
https://github.com/apple/swift-corelibs-libdispatch/commit/766d64719cfdd07f97841092bec596669261a16f

--

Note that none of these languages use GetTickCount64(). Swift is an interesting 
counter point, and I noticed QueryUnbiasedInterruptTime() is available on 
Windows 8 while QueryInterruptTime() is new as of Windows 10. The "Unbiased" 
just refers to whether it advances during sleep.

I'm not actually sure whether time.monotonic() in Python counts time spent 
asleep, or whether that's desirable. Some kinds of timers using monotonic time 
should definitely freeze during sleep so they don't cause a flurry of activity 
on wake, but others definitely need to roughly track wall clock time, even 
during sleep.

Perhaps the long term answer would be to introduce separate "asleep" and 
"awake" monotonic clocks in Python, and possibly deprecate perf_counter() if 
it's redundant after this (as I think it's aliased to monotonic() on 
non-Windows platforms anyway).

--
title: time.monotonic() should use QueryPerformanceCounter() on Windows -> 
time.monotonic() should use a different clock source on Windows

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-09 Thread Ryan Hileman


Ryan Hileman  added the comment:

Great information, thanks!

> Windows 10 also provides QueryInterruptTimePrecise(), which is a hybrid 
> solution. It uses the performance counter to interpolate a timestamp between 
> interrupts. I'd prefer to use this for time.monotonic() instead of QPC, if 
> it's available via GetProcAddress()

My personal vote is to use the currently most common clock source (QPC) for now 
for monotonic(), because it's the same across Windows versions and the most 
likely to produce portable monotonic timestamps between apps/languages on the 
same system. It's also the easiest patch, as there's already a code path for 
QPC.

(As someone building multi-app experiences around Python, I don't want to check 
the Windows version to see which time base Python is using. I'd feel better 
about switching to QITP() if/when Python drops Windows 8 support.)

A later extension of this idea (maybe behind a PEP) could be to survey the 
existing timers available on each platform and consider whether it's worth 
extending `time` to expose them all, and unify cross-platform the ones that are 
exposed (e.g. better formalize/document which clocks will advance while the 
machine is asleep on each platform).

--

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-12 Thread Ryan Hileman


Ryan Hileman  added the comment:

I think a lot of that is based on very outdated information. It's worth reading 
this article: 
https://docs.microsoft.com/en-us/windows/win32/sysinfo/acquiring-high-resolution-time-stamps

I will repeat Microsoft's current recommendation (from that article):

> Windows has and will continue to invest in providing a reliable and efficient 
> performance counter. When you need time stamps with a resolution of 1 
> microsecond or better and you don't need the time stamps to be synchronized 
> to an external time reference, choose QueryPerformanceCounter, 
> KeQueryPerformanceCounter, or KeQueryInterruptTimePrecise. When you need 
> UTC-synchronized time stamps with a resolution of 1 microsecond or better, 
> choose GetSystemTimePreciseAsFileTime or KeQuerySystemTimePrecise.

(Based on that, it may also be worth replacing time.time()'s 
GetSystemTimeAsFileTime with GetSystemTimePreciseAsFileTime in CPython, as 
GetSystemTimePreciseAsFileTime is available in Windows 8 and newer)

PEP 418:

> It has a much higher resolution, but has lower long term precision than 
> GetTickCount() and timeGetTime() clocks. For example, it will drift compared 
> to the low precision clocks.

Microsoft on drift (from the article above):

> To reduce the adverse effects of this frequency offset error, recent versions 
> of Windows, particularly Windows 8, use multiple hardware timers to detect 
> the frequency offset and compensate for it to the extent possible. This 
> calibration process is performed when Windows is started.

Modern Windows also automatically detects and works around stoppable TSC, as 
well as several other issues:

> Some processors can vary the frequency of the TSC clock or stop the 
> advancement of the TSC register, which makes the TSC unsuitable for timing 
> purposes on these processors. These processors are said to have non-invariant 
> TSC registers. (Windows will automatically detect this, and select an 
> alternative time source for QPC).

It seems like Microsoft considers QPC to be a significantly better time source 
now, than when PEP 418 was written.

Another related conversation is whether Python can just expose all of the 
Windows clocks directly (through clock_gettime enums?), as that gives anyone 
who really wants full control over their timestamps a good escape hatch.

--

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-13 Thread Ryan Hileman


Ryan Hileman  added the comment:

> The monotonic clock should thus be based on QueryUnbiasedInterruptTime

My primary complaint here is that Windows is the only major platform with a low 
resolution monotonic clock. Using QueryUnbiasedInterruptTime() on older OS 
versions wouldn't entirely help that, so we have the same consistency issue 
(just on a smaller scale). I would personally need to still use 
time.perf_counter() instead of time.monotonic() due to this, but I'm not 
totally against it.

> For consistency, an external deadline (e.g. for SIGINT support) should work 
> the same way.

Have there been any issues filed about the deadline behaviors across system 
suspend?

> which I presume includes most users of Python 3.9+

Seems like Windows 7 may need to be considered as well, as per vstinner's 
bpo-32592 mention?

> starting with Windows 8, WaitForSingleObject() and WaitForMultipleObjects() 
> exclude time when the system is suspended

Looks like Linux (CLOCK_MONOTONIC) and macOS (mach_absolute_time()) already 
don't track suspend time in time.monotonic(). I think that's enough to suggest 
that long-term Windows shouldn't either, but I don't know how to reconcile that 
with my desire for Windows not to be the only platform with low resolution 
monotonic time by default.

> then the change to use QueryPerformanceCounter() to resolve bpo-41299 should 
> be reverted. The deadline should instead be computed with 
> QueryUnbiasedInterruptTime()

I don't agree with this, as it would regress the fix. This is more of a topic 
for bpo-41299, but I tested QueryUnbiasedInterruptTime() and it exhibits the 
same 16ms jitter as GetTickCount64() (which I expected), so non-precise 
interrupt time can't solve this issue. I do think 
QueryUnbiasedInterruptTimePrecise() would be a good fit. I think making this 
particular timeout unbiased (which would be a new behavior) should be a lower 
priority than making it not jitter.

> For Windows we could implement the following clocks:

I think that list is great and making those enums work with clock_gettime on 
Windows sounds like a very clear improvement to the timing options available. 
Having the ability to query each clock source directly would also reduce the 
impact if time.monotonic() does not perfectly suit a specific application.

---

I think my current positions after writing all of this are:

- I would probably be in support of a 3.11+ change for time.monotonic() to use 
QueryUnbiasedInterruptTime() pre-Windows 10, and dynamically use 
QueryUnbiasedInterruptTimePrecise() on Windows 10+. Ideally the Windows 
clock_gettime() code lands in the same release, so users can directly pick 
their time source if necessary. This approach also helps my goal of making 
time.monotonic()'s suspend behavior more uniform across platforms.

- Please don't revert bpo-41299 (especially the backports), as it does fix the 
issue and tracking suspend time is the same (not a regression) as the previous 
GetTickCount64() code. I think the lock timeouts should stick with QPC 
pre-Windows-10 to fix the jitter, but could use 
QueryUnbiasedInterruptTimePrecise() on Windows 10+ (which needs the same 
runtime check as the time.monotonic() change, thus could probably land in the 
same patch set).

- I'm honestly left with more questions than I started after diving into the 
GetSystemTimePreciseAsFileTime() rabbit hole. I assume it's not a catastrophic 
issue? Maybe it's a situation where adding the clock_gettime() enums would 
sufficiently help anyone who cares about the exact behavior during clock 
modification. I don't have strong opinions about it, besides it being a shame 
that Windows currently has lower precision timestamps in general. Could be 
worth doing a survey of other languages' choices, but any further discussion 
can probably go to bpo-19007.

--

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-14 Thread Ryan Hileman


Ryan Hileman  added the comment:

I agree with not throwing fatal errors, but that check is unlikely to actually 
be hit, and you removed the startup checks covering the underlying clocks here: 
https://github.com/python/cpython/commit/ae6cd7cfdab0599139002c526953d907696d9eef

I think if the time source is broken, a user would probably prefer an exception 
or fatal error to the deadlock they will otherwise get (as time not advancing 
means it's impossible to timeout), so it doesn't make sense to remove the check 
without doing something else about it.

There are three places win_perf_counter_frequency() can fail: 
https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Python/pytime.c#L974

I mention the QueryPerformanceFrequency error case here (stack misalignment): 
https://bugs.python.org/issue41299#msg395237

The other option, besides startup checks, would be to better parameterize the 
timer used (mentioned in bpo-44328): Prefer QueryUnbiasedInterruptTimePrecise 
if available (Win 10+ via GetProcAddress), then QPC, then 
QueryUnbiasedInterruptTime (which has the original bug wrt jitter but should 
never be used as QPC is unlikely to be broken).

--

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-14 Thread Ryan Hileman


Ryan Hileman  added the comment:

Perhaps the simplest initial fix would be to move that check down to 
PyThread__init_thread() in the same file. I'm not sure what the cpython 
convention for that kind of init error is, would it just be the same 
Py_FatalError block or is there a better pattern?

--

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



[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-14 Thread Ryan Hileman


Ryan Hileman  added the comment:

> It shouldn't behave drastically different just because the user closed the 
> laptop lid for an hour

I talked to someone who's been helping with the Go time APIs and it seems like 
that holds pretty well for interactive timeouts, but makes no sense for network 
related code. If you lost a network connection (with, say, a 30 second timeout) 
due to the lid being closed, you don't want to wait 30 seconds after opening 
the lid for the application to realize it needs to reconnect. (However there's 
probably no good way to design Python's locking system around both cases, so 
it's sufficient to say "lock timers won't advance during suspend" and make the 
application layer work around that on its own in the case of network code)

> Try changing EnterNonRecursiveMutex() to break out of the loop in this case

This does work, but unfortunately a little too well - in a single test I saw 
several instances where that approach returned _earlier_ than the timeout.

I assume the reason for this loop is the call can get interrupted with a "needs 
retry" state. If so, you'd still see 16ms of jitter anytime that happens as 
long as it's backed by a quantized time source.

--

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



[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2021-06-14 Thread Ryan Hileman


Ryan Hileman  added the comment:

> Do you think that pytime.c has the bug? I don't think so.

No, a misaligned stack would be an issue in the caller or compiler, not 
pytime.c. I have hit misaligned stack in practice, but it should be rare enough 
to check on init only.

> In theory yes, in practice we got zero error reports. So it sounds like it 
> cannot happen.
> I don't think that it's a good practice to start to add checks in all 
> functions using a clock "just in case" the clock might fail.

My read is that as long as we're not confident enough to remove those checks 
from pytime.c, a caller should assume they're reachable. If the pytime checks 
need to stay, adding a Windows only pytime init check to make sure that locks 
won't deadlock sounds fine to me.

--

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



[issue44437] Add multimap() function similar to map(), but with multiprocessing functionality to the multiprocessing module

2021-06-16 Thread Ryan Rudes


Change by Ryan Rudes :


--
components: Tkinter
nosy: Ryan-Rudes
priority: normal
severity: normal
status: open
title: Add multimap() function similar to map(), but with multiprocessing 
functionality to the multiprocessing module
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

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



[issue44437] Add multimap() function similar to map(), but with multiprocessing functionality to the multiprocessing module

2021-06-16 Thread Ryan Rudes


Change by Ryan Rudes :


--
keywords: +patch
pull_requests: +25347
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26762

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



[issue44437] Add multimap() function similar to map(), but with multiprocessing functionality to the multiprocessing module

2021-06-16 Thread Ryan Rudes


Change by Ryan Rudes :


--
components: +Library (Lib) -Tkinter

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



[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-07-25 Thread Ryan Ozawa


Ryan Ozawa  added the comment:

Hi all,

This is my first issue so feedback is welcome.

Following @vstinner 's suggestions:
> * os.rename() can fail if source and destination are on two different
file systems
> * Use shutil.move() to support move to a different directory

And from @eryksun :
> ... on Windows the "operation will fail if src and dst are on different 
> filesystems".

Just 2 short lines:
2292,6 +2292,8 @@ features:
will fail with an :exc:`OSError` subclass in a number of cases:
 
On Windows, if *dst* exists a :exc:`FileExistsError` is always raised.
+   The operation will fail if *src* and *dst* are on different filesystems. Use
+   :func:`shutil.move` to support moves to a different filesystem.


If nothing to change, I will make a PR soon.

--
keywords: +patch
nosy: +rhyn0
Added file: https://bugs.python.org/file50180/os_rename_windows.patch

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



[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-07-26 Thread Ryan Ozawa


Change by Ryan Ozawa :


--
pull_requests: +25912
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/27376

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



[issue44752] Tab completion executes @property getter function

2021-07-27 Thread Ryan Pecor


New submission from Ryan Pecor :

After making a class using the @property decorator to implement a getter, using 
tab completion that matches the getter function name executes the function. 

See below for example (line numbers added,  indicates when the user 
presses the tab key):

1  >>> class Foo(object):
2  ... def __init__(self,value):
3  ... self.value = value
4  ... @property
5  ... def print_value(self):
6  ... print("Foo has a value of {}".format(self.value))
7  ... 
8  >>> bar = Foo(4)
9  >>> bar.~~~Foo has a value of 4~~~
10 ~~~Foo has a value of 4~~~
11 
12 bar.print_value  bar.value
13 >>> bar.p~~~Foo has a value of 4~~~
14 rint_value~~~Foo has a value of 4~~~
15 ~~~Foo has a value of 4~~~
16 
17 bar.print_value
18 >>> bar.value

I pressed tab after typing "bar." in line 9. It then printed the remainder of 
line 9 and moved the cursor to line 10. Pressing tab again prints line 10 and 
11 before finally showing the expected output on line 12. lines 13-17 follow 
the same steps, but after typing "bar.p" to show that it happens whenever you 
tab and it matches the getter. Line 18 shows a correct tab completion resulting 
from hitting tab after typing "bar.v" which does not match the getter function.

--
components: Interpreter Core
messages: 398323
nosy: RPecor
priority: normal
severity: normal
status: open
title: Tab completion executes @property getter function
type: behavior
versions: Python 3.9

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



[issue44752] Tab completion executes @property getter function

2021-07-27 Thread Ryan Pecor


Ryan Pecor  added the comment:

I forgot to mention that I also added "~~~" to either side of the printed 
string every time it printed to help differentiate the printed string from 
commands that I typed into the interpreter.

--

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



[issue44752] Tab completion executes @property getter function

2021-07-27 Thread Ryan Pecor


Ryan Pecor  added the comment:

It looks to me like the issue is caused by the eval() in line 155 of the 
rlcompleter.py file 
(https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/rlcompleter.py#L155)
 which runs the function in order to see if it runs or raises an exception.

I thought maybe replacing it with hasattr() might work, but it looks like the 
issue is repeated there as well!

>>> hasattr(bar, "print_value")
Foo has a value of 4
True

This goes over to the C side of things now 
(https://github.com/python/cpython/blob/196998e220d6ca030e5a1c8ad63fcaed8e049a98/Python/bltinmodule.c#L1162)
 and I'll put in another issue regarding that!

--

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



  1   2   3   4   5   >