[issue1651995] sgmllib _convert_ref UnicodeDecodeError exception, new in 2.

2007-10-31 Thread Simon

Changes by Simon:


--
nosy: +bind

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



[issue1651995] sgmllib _convert_ref UnicodeDecodeError exception, new in 2.5

2007-11-01 Thread Simon

Simon added the comment:

The 255 -> 127 change works for me. Let me know if I can help with unit
tests or whatever to get this patched.

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



[issue8093] IDLE processes don't close

2011-06-21 Thread Simon

Simon  added the comment:

Not sure if this is related, but for me none of the F5 processes (command line 
"pythonw.exe -c __import__('idlelib.run').run.main(True) ") ever exit on 
either 2.7.2 or 3.2.1rc1.

------
nosy: +Simon

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



[issue12928] exec not woking in unittest

2011-09-07 Thread simon

New submission from simon :

works in 2.6, fails in 3.2.2

import unittest
class MyTest(unittest.TestCase):
def test_a(self):
exec(compile("a = 1", '', 'single'))
assert a == 1
if __name__ == '__main__':
unittest.main()

--
components: Library (Lib)
messages: 143672
nosy: simonsteiner
priority: normal
severity: normal
status: open
title: exec not woking in unittest
type: compile error
versions: Python 3.2

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



[issue12928] exec not woking in unittest

2011-09-07 Thread simon

simon  added the comment:

seems i need to use

exec(compile("a = 1", '', 'single'), globals())

--

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



[issue12928] exec not woking in unittest

2011-09-07 Thread simon

simon  added the comment:

Can't get this one working:

import unittest
class MyTest(unittest.TestCase):
def test_a(self):
b = 1
exec(compile("a = b + 1", '', 'single'))
assert a == 2
if __name__ == '__main__':
unittest.main()

--

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



[issue8534] multiprocessing not working from egg

2010-04-26 Thread simon

New submission from simon :

testmultiprocessing.py:

def main():
import multiprocessing

proc = multiprocessing.Process(target=runhi)
proc.start()
proc.join()

def runhi():
print 'hi'

if __name__ == "__main__":
main()

testmultiprocessing.py is inside myegg.egg

set PYTHONPATH=myegg.egg

python -m testmultiprocessing

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
  File "C:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named testmultiprocessing

--
components: Library (Lib)
messages: 104215
nosy: simonsteiner
severity: normal
status: open
title: multiprocessing not working from egg
versions: Python 2.6

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



[issue8534] multiprocessing not working from egg

2010-04-26 Thread simon

Changes by simon :


--
keywords: +patch
Added file: http://bugs.python.org/file17092/forking.patch

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



[issue39589] Logging QueueListener should support context manager

2020-02-08 Thread Simon


New submission from Simon :

The QueueListener could be extended to support the context manager.

--
components: Library (Lib)
messages: 361641
nosy: sbrugman
priority: normal
severity: normal
status: open
title: Logging QueueListener should support context manager
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue39589] Logging QueueListener should support context manager

2020-02-08 Thread Simon


Change by Simon :


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

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



[issue39589] Logging QueueListener should support context manager

2020-02-19 Thread Simon


Simon  added the comment:

The QueueListener in the logging library starts a background thread to monitor 
the log event queue. The context manager support is ideal in this case, making 
the code simpler, more consistent with other classes (e.g. 
multiprocessing.Pool) and prompts stopping the thread.

Without support for the context manager we need the following code:

```
queue_listener = QueueListener(queue, handler)
queue_listener.start()
# queue messages
queue_listener.stop()
```

adding context manager support would result in the following equivalent code:

```
with QueueListener(queue, handler) as queue_listener:
# queue messages
```

--

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



[issue39589] Logging QueueListener should support context manager

2020-02-19 Thread Simon


Change by Simon :


--
pull_requests: +17944
pull_request: https://github.com/python/cpython/pull/18563

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2018-07-03 Thread simon


New submission from simon :

when compiling Python 3.7.0 setup.py is reporting that the ssl module failed to 
compile due to missing support for X509_VERIFY_PARAM_set1_host()  despite it 
existing in rsa.h for all versions of OpenSSL 1.1.0.

Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with 
X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, 
https://github.com/libressl-portable/portable/issues/381

In addition _ssl.o does actually compile.

The issue appears that _ssl is appearing in "missing", "self.failed", 
"self.failed_on_import"



setup.py

366 if any('_ssl' in l
367for l in (missing, self.failed, self.failed_on_import)):
368 print()
369 print("Could not build the ssl module!")
370 print("Python requires an OpenSSL 1.0.2 or 1.1 compatible "
371   "libssl with X509_VERIFY_PARAM_set1_host().")
372 print("LibreSSL 2.6.4 and earlier do not provide the 
necessary "
373   "APIs, 
https://github.com/libressl-portable/portable/issues/381";)
374 print()

I havent had time to go through the code yet to find out where the error is 
gettng flagged and if its a associated with how I have compiled openssl i.e. I 
need a compilation flag to enabled  X509_VERIFY_PARAM_set1_host() support.

--
assignee: christian.heimes
components: SSL
messages: 320947
nosy: christian.heimes, si...@simonfoley.net
priority: normal
severity: normal
status: open
title: Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing 
X509_VERIFY_PARAM_set1_host()  support
versions: Python 3.7

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2018-07-03 Thread simon


simon  added the comment:

Apologies, my bad you are correct the function was defined in x509_vfy.h

Im compiling on RHEL
Red Hat Enterprise Linux Server release 7.5 (Maipo)
I have tried Openssl from source versions;
openssl-1.0.2o  (this releaseis a mess and the folder structure has been 
altered)
openssl-1.1.0h
openssl-1.1.0

I havce tried 
Python-3.7.0
Python-3.6.3

checking for pkg-config... /usr/bin/pkg-config
checking for openssl/ssl.h in /usr/local/ssl... no
checking for openssl/ssl.h in /usr/lib/ssl... no
checking for openssl/ssl.h in /usr/ssl... no
checking for openssl/ssl.h in /usr/pkg... no
checking for openssl/ssl.h in /usr/local... no
checking for openssl/ssl.h in /usr... no
checking whether compiling and linking against OpenSSL works... no
checking for --with-ssl-default-suites... python

My details of Setup are;

SSL=/home/{my_home_folder}/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL) -lssl -lcrypto

I now spot that the Linker is having issues (-L)

libssl.so & cyypt.so   is in /home/{my_home_folder}/openssl
all the header files are in;

=/home/{my_home_folder}/openssl/include/openssl

including opensslconf.h
however not of the declarations have been commented out including any of the 

DEPRECATEDIN_1_0_0  etc etc

--

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2018-07-05 Thread simon


simon  added the comment:

Thanks 

I have found teh root cause of the problem ...

--with-openssl=[my_dir]

The configure scripts has an assumption you are compiling against a binary 
packaged version of openssl and that there is a /lib folder under [my_dir]. 
This simply does not exist under any of the source code releases of openssl. So 
after I compiled the openssl source code I had to create the lib folder under 
my openssh build directory and symlink the *.so libraries there for the 
configure script to work

This is still an issue even if you edit Setup correctlty to compile the module.

>> This is a problem for people like me who are institutional users that have 
>> cross platform enterprise softwre deployment platforms (e.g. BladeLogic). 
>> There are restricted policies on what packages you can install on a server. 
>> In most cases especially for in house developed software) you need to build 
>> all dependencies seperatly and bundle them into a package (e.g. /opt RPM) 
>> that includes all required depencencies rather than rely on distribution 
>> library packages that are hard to manage at an Enterprise level and where 
>> you may be sharing the same OS.


To make the code more robust should it not 1st check under the root of [my_dir] 
before assuming [my_dir]/lib exests or at least report teh full path with the 
/lib added onto teh end of {my_dir} so you know where confiure has gone wrong ?

Is this not a fair expectation?

no lib folder
checking for openssl/ssl.h in /home/BD7046/openssl... no
checking whether compiling and linking against OpenSSL works... no

with lib folder
checking for openssl/ssl.h in /home/BC7046/openssl... yes
checking whether compiling and linking against OpenSSL works... yes


Thanks for all your help 
#PortingPerltoPython

--

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



[issue15901] multiprocessing sharedctypes Array don't accept strings

2012-09-10 Thread Simon

Changes by Simon :


--
assignee:  -> docs@python
components: +Documentation -ctypes
nosy: +docs@python
type: crash -> behavior

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



[issue6500] urllib2 maximum recursion depth exceeded

2009-07-17 Thread simon

New submission from simon :

def __getattr__(self, attr):
# XXX this is a fallback mechanism to guard against these
# methods getting called in a non-standard order.  this may be
# too complicated and/or unnecessary.
# XXX should the __r_XXX attributes be public?
if attr[:12] == '_Request__r_':
name = attr[12:]
if hasattr(Request, 'get_' + name):
getattr(self, 'get_' + name)()
return getattr(self, attr)
raise AttributeError, attr

this may cause "maximum recursion depth exceeded"

>>> import urllib2
>>> req = urllib2.Request('http://www.nbc.com')
>>> req._Request__r_method
RuntimeError: maximum recursion depth exceeded

"return getattr(self, attr)"? should it be removed?

--
components: Library (Lib)
messages: 90612
nosy: nako521
severity: normal
status: open
title: urllib2 maximum recursion depth exceeded
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-20 Thread Simon

New submission from Simon:

I downloaded the Embeddable zip file from the Python site, 
(https://www.python.org/downloads/release/python-351/) and rand the code below.

When I run the code below certain modules are not imported while others are 
imported fine.
The modules that are not imported seem to be the ones sub-directories within 
the zip file.

(omitted obvious code, error checking and some cleanup)

...
int main()
{
  // ... 
  Py_SetProgramName(L"A"); 
  Py_SetPath(L"path\\to\\python35.zip"); // embeddable from the python 
site. 
  Py_Initialize(); 
  PyThreadState *mainstate = PyThreadState_Get(); 
  PyInterpreterState* mainInterpreterState = mainstate->interp; 
  
  PyObject *main_module = PyImport_AddModule("__main__"); 
  PyObject *main_dict = PyModule_GetDict(main_module); 
  PyObject *local_dic = PyDict_New(); 

  const char* s = "import ctypes\n"; 
  PyObject * PyRes = PyRun_String(s, Py_file_input, main_dict, local_dic); 
  PyObject* ex = PyErr_Occurred(); 
  if (NULL != ex) 
  { 
//  didn't work, import error. 
  } 
}

The exact same code above manages to import other modules as long as they are 
located inside the root of the zip file.

modules like json/ctypes and so on are not imported as they are in a sub 
directory.

--
messages: 262101
nosy: SimonG, amaury.forgeotdarc, belopolsky, meador.inge, paul.moore, 
steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Embbedable zip does not import modules in (zip)subdirectory
type: behavior
versions: Python 3.5

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-20 Thread Simon

Changes by Simon :


--
components: +Interpreter Core, Windows

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Simon

Simon added the comment:

I have tried with the zip file in both the exe alongside the zip and not 
alongside it, (mine was not).

And I get the same error in both cases.

I am using Windows 10, VS2015.

I compile the Python35.dll directly and my config is default, I don't change 
anything really.

Do you build the Python35.dll or where do you get it from? Do you add something 
to your config?

--

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Simon

Simon added the comment:

1- New solution Win32 "console application", (left all default settings).
2- downloaded "Gzipped source tarball" from 
https://www.python.org/downloads/release/python-351/
3- Extracted everything, (didn't change anything).
4- Added "pythoncore.vcxproj" in "Python-3.5.1\PCbuild" to the solution above.
5- Compiled to make sure... "python35_d.dll" and "python35_d.lib" created in 
"Python-3.5.1\PCbuild\win32"
6- Added the "Python-3.5.1\PCbuild\win32" to my library include folder
7- Added "Python-3.5.1\Include" to my additional include folder. (for Python.h)
7- Added "Python-3.5.1\PC" to my additional include folder. (for Pyconfig.h)
8- Added "#include "Python.h"" to my ConsoleApplicaiton.cpp
9- Compile, all good.
10- downloaded "Windows x86-64 embeddable zip file" from link above.
11- Copied the created "python35_d.dll" to my debug folder.
12- Replaced "path\\to\\python35.zip" with the full path of the embeddable zip 
file.

And I get the same issue.

PyErr_Print(); output.

Trackback (most recent call last):
  File "", line 1, in 
  File "ctypes\__init__.py, line 8, in 
ImportError: No module named '_ctypes'

"import unittest" - works

"import winsound" - does not work, same error as above.

Please let me know if I should do anything else.

--

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Simon

Simon added the comment:

Sorry I should add that 

1- I do *not* have python installed on my dev machine.
2- VS2015 Enterprise.
3- Windows 10 - x64
4- *Not* running as admin

Everything else is fairly standard.

--

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-22 Thread Simon

Simon added the comment:

Yes, it was a debug build, I didn't know it only works in release, that's the 
part I was clearly missing.

It would be great if we could have a debug embeddable zip file, but I 
understand that it might be asking for a bit much.

Is the project that builds all the pyds available? Maybe I could create my own 
embeddable debug zip.

Thanks

--

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-22 Thread Simon

Simon added the comment:

Not sure if I should be closing the issue or if you should.
I think it is not an issue.

--

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



[issue43137] webbrowser to support "gio open "

2022-01-05 Thread Simon McVittie


Change by Simon McVittie :


--
keywords: +patch
pull_requests: +28623
pull_request: https://github.com/python/cpython/pull/30417

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



[issue43137] webbrowser to support "gio open "

2022-01-05 Thread Simon McVittie


Simon McVittie  added the comment:

I've opened https://github.com/python/cpython/pull/30417, is that what you want?

I am not a regular CPython developer, so I don't have a good way to assess 
which reviewers speak for the project and which reviewers are only offering a 
personal opinion.

--

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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-08 Thread Simon Wrede


New submission from Simon Wrede :

Documentation states that a reference must be kept when creating a task, 
https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task.

This is not done in StreamReaderProtocol, 
https://github.com/python/cpython/blob/main/Lib/asyncio/streams.py#L244.

I've provided a simple example to force garbage collection of this task which 
results in `Task was destroyed but it is pending!`. Uncommenting the commented 
code of the example shows that the task is not destroyed when a reference is 
kept.

Am I missing something or using the library incorrectly? I've followed the 
examples at 
https://docs.python.org/3/library/asyncio-stream.html#tcp-echo-server-using-streams.

--
components: asyncio
files: example.py
messages: 410124
nosy: asvetlov, simwr872, yselivanov
priority: normal
severity: normal
status: open
title: Task created by StreamReaderProtocol gets garbage collected.
versions: Python 3.10
Added file: https://bugs.python.org/file50552/example.py

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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-08 Thread Simon Wrede


Change by Simon Wrede :


--
type:  -> behavior

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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-09 Thread Simon Wrede


Change by Simon Wrede :


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

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



[issue46309] Task created by StreamReaderProtocol gets garbage collected.

2022-01-11 Thread Simon Wrede


Change by Simon Wrede :


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

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



[issue41962] Make threading._register_atexit public?

2022-02-03 Thread Simon Arlott


Simon Arlott  added the comment:

Another way to do this is to call threading.main_thread().join() in another 
thread and do the shutdown cleanup when it returns.

The main thread is stopped at shutdown just before the 
threading._threading_atexits are called.

--
nosy: +sa

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



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-01 Thread Simon Anders

Changes by Simon Anders:


--
components: Build, Interpreter Core
severity: normal
status: open
title: ''.find() gives wrong result in Python built with ICC
versions: Python 2.5

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



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-01 Thread Simon Anders

New submission from Simon Anders:

I have just encountered a strange bug affecting Python 2.5.1 on an
x86_64 Linux, but only when compiled with the Intel C Compiler (ICC)
10.0, not a GCC-compiled Python. On my Intel-compiled one, which
otherwise seems to work fine, ''.find() works incorrectly.

I have narrowed down the issue to the simple test case

   "foo2/**bar**/".find ("/**bar**/")

Observe: On a GCC-compiled Python 2.5.1, the command works as
expected by returning 4:

  [EMAIL PROTECTED] tmp]$ /usr/site/hc-2.6/python/gnu/2.5.1/bin/python2.5
  Python 2.5.1 (r251:54863, Aug 30 2007, 16:21:23)
  [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> print "foo2/**bar**/".find ("/**bar**/")
  4

On my Python 2.5.1 installation which was compiled from source with the
Intel C Compiler (ICC) for Linux, version 10.0, '-1' is returned:

  [EMAIL PROTECTED] tmp]$ /usr/site/hc-2.6/python/intel/2.5.1/bin/python2.5
  Python 2.5.1 (r251:54863, Aug 30 2007, 16:20:06)
  [GCC Intel(R) C++ gcc 3.4 mode] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> print "foo2/**bar**/".find ("/**bar**/")
  -1

What could have possibly gone wrong here? Admittedly, this smacks more
of a bug in icc than in Python, but I report it here, as I feel at loss
of what else to do with it.

Obvious first question: Does anyone else out here have an ICC-compiled
Python handy  to check whether the bug reproduces elsewhere?

Any idea what kind of oddity I have stumbled over here? Obviously, it
could simply be that something went wrong when compiling Python from
source with ICC, but it should not happen that the interpreter
nebertheless starts up and fails only silently.

Additional information:

- I have stumbled over the problem when trying to install Numpy 1.0.3.1,
as the built failed at the point where a script 'conv_template.py',
which is part of NumPy's installtion system, is started to do some
pattern replacements in a file called 'scalartypes.inc.src'. My test
case is reduced from this script.

- The system is the master node of a compute cluster with AMD Opteron
CPUs. The cluster is not involved, all was done on the master node. The
box runs RedHat Enterprise Linux 4.0 Advanced Server. It replies to
'uname -a' with:
   Linux hc-ma.uibk.ac.at 2.6.9-42.0.10.ELsmp #1 SMP Fri Feb 16 17:13:42
EST 2007 x86_64 x86_64 x86_64 GNU/Linux

- The dynamic dependencies of the GCC-compiled and the ICC-compiled
Python binaries are:
[EMAIL PROTECTED] tmp]$ ldd /usr/site/hc-2.6/python/gnu/2.5.1/bin/python2.5
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x00370290)
libdl.so.2 => /lib64/libdl.so.2 (0x003701d0)
libutil.so.1 => /lib64/libutil.so.1 (0x00370390)
libm.so.6 => /lib64/tls/libm.so.6 (0x003701b0)
libc.so.6 => /lib64/tls/libc.so.6 (0x00370180)
/lib64/ld-linux-x86-64.so.2 (0x00370160)
[EMAIL PROTECTED] tmp]$ ldd /usr/site/hc-2.6/python/intel/2.5.1/bin/python2.5
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x00370290)
libdl.so.2 => /lib64/libdl.so.2 (0x003701d0)
libutil.so.1 => /lib64/libutil.so.1 (0x00370390)
libimf.so => /usr/site/hc-2.6/intel/10.0/cc/lib/libimf.so
(0x002a95579000)
libm.so.6 => /lib64/tls/libm.so.6 (0x003701b0)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00370580)
libc.so.6 => /lib64/tls/libc.so.6 (0x00370180)
/lib64/ld-linux-x86-64.so.2 (0x00370160)

- The precise revision of Python is "Python 2.5.1 (r251:54863)".

- The test case ceases to show failure if the string is only slightly
altered, e.g. if the word 'foo', the word 'bar' or the one of the
asterisks or one of the slashes is cut out in both search and target string.

--
nosy: +sanders_muc

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



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Simon Anders

Simon Anders added the comment:

Martin, you are right: is is related to compiler optimization. I have
boiled it down to a call of stringlib_find (defined in
Python-2.5.1/Objects/stringlib/find.h) and this runs fine with 'icc -O2'
but incorrectly for 'icc -O3'. (The test code is attached.)

So, it seems that the lesson is simply once again: Do not use '-O3' with
Intel's C compiler. (At least, for me, it is not the first time that
this caused trouble.)

On the other hand, Python's ./configure script is quite clear in its
preference of GCC, anyway: It more or less ignores with option
'--without-gcc' and uses the content of the CC environment variable only
very occasionally.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1084>
__#define STRINGLIB_CHAR char

#define STRINGLIB_CMP memcmp
#define STRINGLIB_LEN PyString_GET_SIZE
#define STRINGLIB_NEW PyString_FromStringAndSize
#define STRINGLIB_STR PyString_AS_STRING

#define STRINGLIB_EMPTY nullstring

#include "/usr/site/hc-2.6/python/gnu/2.5.1/include/python2.5/Python.h"

#include "../Python-2.5.1/Objects/stringlib/fastsearch.h"
#include "../Python-2.5.1/Objects/stringlib/find.h"

int main ()
{
   STRINGLIB_CHAR* str = "foo2/**bar**/";
   Py_ssize_t str_len = strlen (str);
   STRINGLIB_CHAR* sub = "/**bar**/";
   Py_ssize_t sub_len = strlen (sub);
   Py_ssize_t offset = 0;
   Py_ssize_t res;

   res = stringlib_find(str, str_len, sub, sub_len, offset);

   printf ("%d\n", res);
   return 0;
}
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Simon Anders

Simon Anders added the comment:

Martin: I've boiled down the test case a bit more and removed all
Python-specific types and macros, so that it can now be compiled
stand-alone. (Updated test case 'findtest.c' attached.) I didn't feel
like diving into the code much deeper, and so I have sent it to Intel
Premier Support as Issue #448807. Let's see if they bother to
investigate it further.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1084>
__/* 
Testcase for problem with 'icc -O3':

The function 'fastsearch' is taken from the source code of Python 2.5
and looks for the substring 'p' (of length 'm') within the string 's'
(of length 'n'). If 'mode' is 'FAST_COUNT' the number of occurences of
p in s is returned, and for 'FAST_SEARCH', the position of the first 
occurence.

For the specific values used in main() below, the function returns 
correctly '4', if compiled with at most optimization '-O2', but '-1'
for optimization level '-O3'.

I have just changed the Python-specific types to standard ones, otherwise
fastsearc() is as defined in file Objects/stringlib/fastsearch.h of
the Python 2.5.1 source code. It has been written by Fredrik Lundh and
is described in his blog here: http://effbot.org/zone/stringlib.htm

   Simon Anders, [EMAIL PROTECTED], 2007-09-02
*/

#include 
#include 
#define FAST_COUNT 0
#define FAST_SEARCH 1

inline int
fastsearch(const char* s, int n,
   const char* p, int m,
   int mode)
{
long mask;
int skip, count = 0;
int i, j, mlast, w;

w = n - m;

if (w < 0)
return -1;

/* look for special cases */
if (m <= 1) {
if (m <= 0)
return -1;
/* use special case for 1-character strings */
if (mode == FAST_COUNT) {
for (i = 0; i < n; i++)
if (s[i] == p[0])
count++;
return count;
} else {
for (i = 0; i < n; i++)
if (s[i] == p[0])
return i;
}
return -1;
}

mlast = m - 1;

/* create compressed boyer-moore delta 1 table */
skip = mlast - 1;
/* process pattern[:-1] */
for (mask = i = 0; i < mlast; i++) {
mask |= (1 << (p[i] & 0x1F));
if (p[i] == p[mlast])
skip = mlast - i - 1;
}
/* process pattern[-1] outside the loop */
mask |= (1 << (p[mlast] & 0x1F));

for (i = 0; i <= w; i++) {
/* note: using mlast in the skip path slows things down on x86 */
if (s[i+m-1] == p[m-1]) {
/* candidate match */
for (j = 0; j < mlast; j++)
if (s[i+j] != p[j])
break;
if (j == mlast) {
/* got a match! */
if (mode != FAST_COUNT)
return i;
count++;
i = i + mlast;
continue;
}
/* miss: check if next character is part of pattern */
if (!(mask & (1 << (s[i+m] & 0x1F
i = i + m;
else
i = i + skip;
} else {
/* skip: check if next character is part of pattern */
if (!(mask & (1 << (s[i+m] & 0x1F
i = i + m;
}
}

if (mode != FAST_COUNT)
return -1;
return count;
}


int main ()
{
   char* str = "foo2/**bar**/";
   int str_len = strlen (str);
   char* sub = "/**bar**/";
   int sub_len = strlen (sub);
   int offset = 0;
   int res;

   res = fastsearch (str, str_len, sub, sub_len, FAST_SEARCH);

   printf ("%d\n", res);
   return 0;
}
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1358] Compile error on OS X 10.5

2007-11-22 Thread Simon Percivall

Simon Percivall added the comment:

It has to do with the MACOSX_DEPLOYMENT_TARGET. If it's set to 10.4, the 
legacy version of setpgrp is used (with args), it it's 10.5, setpgrp 
expects no arguments. It seems configure won't detect the difference.

--
nosy: +percivall

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



[issue13194] zlib (de)compressobj copy() method missing on Windows

2011-10-16 Thread Simon Elén

New submission from Simon Elén :

The zlib (de)compressobj copy() method is missing on Windows.

Tested on Python 2.7.2 and 3.2.2 Windows binaries. I have not tried to build 
from source.

(In the source code I can see a check for HAVE_ZLIB_COPY. Does the Windows 
binaries statically link the included zlib source? If so, it should be new 
enough to pass that check...)

--
components: Library (Lib), Windows
messages: 145644
nosy: Simon.Elén
priority: normal
severity: normal
status: open
title: zlib (de)compressobj copy() method missing on Windows
type: behavior
versions: Python 2.7, Python 3.2

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

New submission from Simon Sapin :

Hi,

The attached patch adds a 'key' optional parameter to the heapq.merge function 
that behaves as in sorted().

Related discussion: 
http://mail.python.org/pipermail/python-ideas/2012-January/013295.html

This is my first contribution to CPython.

--
components: Library (Lib)
files: heapq_merge_key.patch
keywords: patch
messages: 150927
nosy: SimonSapin, rhettinger
priority: normal
severity: normal
status: open
title: Add a key parameter (like sorted) to heapq.merge
type: enhancement
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file24184/heapq_merge_key.patch

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

Simon Sapin  added the comment:

The attached script benchmarks the basline (current implementation) against 3 
new implementations, as suggested on 
http://mail.python.org/pipermail/python-ideas/2012-January/013296.html

On my machine, the output is:

merge_baseline
per run, min of 3 = 7.527 ms

merge_1
per run, min of 3 = 9.894 ms
131.449 % of baseline

merge_2
per run, min of 3 = 7.948 ms
105.594 % of baseline

merge_3
per run, min of 3 = 7.581 ms
100.716 % of baseline

On this particular input, merge_2 adds 6% of overhead when the key parameter is 
not used. While merge_3 only adds 1% of overhead, it almost doubles the amount 
of code. (Which was admittedly not that long to begin with.)

The patch in the previous message is with the merge_2 implementation, which 
seemed like the best compromise to me.

--
Added file: http://bugs.python.org/file24185/benchmark_heapq_merge.py

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

Simon Sapin  added the comment:

Oops, the patch to the documentation would also need 'New in 3.3: the key 
parameter', with the right Sphinx directive. But that depends on whether this 
change ends up in 3.3 or 3.4.

Does 3.3 still get new features?

--

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



[issue5441] Convenience API for timeit.main

2012-01-09 Thread Simon Sapin

Changes by Simon Sapin :


--
nosy: +ssapin

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

Simon Sapin  added the comment:

Raymond, please have a look at merge_3 in benchmark_heapq_merge.py. It is 
implemented as you say.

Do you think the speed is worth the code duplication?

--

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



[issue12345] Add math.tau

2011-06-16 Thread Simon Baird

Changes by Simon Baird :


--
nosy: +sbaird

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



[issue12590] First line and cursor not visible when opening files

2011-07-19 Thread Simon Forman

New submission from Simon Forman :

In IDLE if you open a file that is longer than the editor window the first 
line, with the cursor, is scrolled off the top of the window making it appear 
as though the file begins at the second line.

This can be fixed by adding 'text.see("insert")' to the end of the EditorWindow 
__init__() method, but see Bruce Sherwood's comment on 
http://bugs.python.org/issue10079#msg118618

--
components: IDLE
messages: 140716
nosy: sforman
priority: normal
severity: normal
status: open
title: First line and cursor not visible when opening files
type: behavior
versions: Python 2.6

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



[issue10469] test_socket fails using Visual Studio 2010

2011-07-26 Thread Simon Buchan

Simon Buchan  added the comment:

Confirming this patch fixes the test_aynsc* tests in my VS10 build. Shouldn't 
it swap all WSA* defines to protect against this in the future, though? 
Alternatively, should the check for WSA* codes existing be in Lib\asyncore.py?

--
nosy: +Simon

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



[issue12590] First line and cursor not visible when opening files

2011-07-26 Thread Simon Forman

Simon Forman  added the comment:

You're very welcome.

--

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



[issue12688] ConfigParser.__init__(iterpolation=None) documentation != behavior

2011-08-03 Thread John Simon

New submission from John Simon :

The ConfigParser docs say that when __init__ is called with interpolation=None, 
no interpolation occurs. But when this is done in Python 3.2.1, it actually 
results in an AttributeError upon getting or setting a value, due to 
self._interpolation being set to None.

This incredibly simple patch brings the behavior inline with the docs.

--
components: Library (Lib)
files: patch.txt
messages: 141615
nosy: zildjohn01
priority: normal
severity: normal
status: open
title: ConfigParser.__init__(iterpolation=None) documentation != behavior
type: behavior
Added file: http://bugs.python.org/file22832/patch.txt

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



[issue444582] Finding programs in PATH, adding shutil.which

2011-08-08 Thread Simon Law

Changes by Simon Law :


--
nosy: +sfllaw

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



[issue10059] add the method `index` to collections.deque

2010-10-09 Thread Simon Liedtke

New submission from Simon Liedtke :

I'd like to have the method `index` not only for list, but also for 
collections.deque.

Here is my attempt: 
http://bitbucket.org/derdon/hodgepodge/src/tip/extended_deque.py

I'm looking forward to see this method implemented in the stdlib!

--
components: Library (Lib)
messages: 118296
nosy: Simon.Liedtke
priority: normal
severity: normal
status: open
title: add the method `index` to collections.deque
type: feature request

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



[issue10059] add the method `index` to collections.deque

2010-10-10 Thread Simon Liedtke

Simon Liedtke  added the comment:

I see that adding this method to a deque is useless. A list is better for this 
kind of operation. I just wrote it for fun and realized that it was implemented 
rather slow.

--
resolution:  -> rejected
status: open -> closed

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



[issue4236] Crash when importing builtin module during interpreter shutdown

2010-11-20 Thread Simon Cross

Simon Cross  added the comment:

I'm attaching a patch to relax the check in PyModule_Create2 as suggested by 
the Amaury (http://bugs.python.org/issue4236#msg75409).

The patch uses "PyThreadState_Get()->interp->modules == NULL" to determine 
whether the import machinery has been cleaned up yet.

The test suite still appears to pass.

--
nosy: +hodgestar
Added file: http://bugs.python.org/file19655/check-import-machinery-only.diff

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-20 Thread Simon Cross

Simon Cross  added the comment:

I made the minor changes needed to get Eli Bendersky's patch to apply against 
3.2. Diff attached.

--
nosy: +hodgestar
Added file: http://bugs.python.org/file19675/issue2986.fix32.5.patch

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



[issue8647] PyUnicode_GetMax is undocumented

2010-11-20 Thread Simon Cross

Simon Cross  added the comment:

This issue is subsumed by #10435 and can probably be closed as a duplicated.

--
nosy: +hodgestar

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



[issue8646] PyUnicode_EncodeDecimal is undocumented

2010-11-20 Thread Simon Cross

Simon Cross  added the comment:

This issue is subsumed by #10435 and can probably be closed as a duplicated.

--
nosy: +hodgestar

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



[issue8645] PyUnicode_AsEncodedObject is undocumented

2010-11-20 Thread Simon Cross

Simon Cross  added the comment:

This issue is subsumed by #10435 and can probably be closed as a duplicated.

--
nosy: +hodgestar

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



[issue10435] Document unicode C-API in reST

2010-11-20 Thread Simon Cross

Changes by Simon Cross :


--
nosy: +hodgestar

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-24 Thread Simon Cross

Simon Cross  added the comment:

My vote is that this bug be closed and a new feature request be opened. Failing 
that, it would be good to have a concise description of what else we would like 
done (and the priority should be downgraded, I guess).

--

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



[issue2844] int() lies about base parameter

2008-05-13 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Some quick digging in the code on trunk has revealed that by the time
the base reaches PyInt_FromString in intobject.c, -909 has become 10.
Surrounding numbers seem to come through fine.

--
nosy: +hodgestar

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



[issue2844] int() lies about base parameter

2008-05-13 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

In int_new in intobject.c the base -909 is used to indicate that no base
has been passed through (presumably because NULL / 0 is a more common
pitfall that -909). Thus -909 is equivalent to base 10.

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



[issue2517] Error when printing an exception containing a Unicode string

2008-06-09 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

One of the examples Christoph tried was

  unicode(Exception(u'\xe1'))

which fails quite oddly with:

  UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in
position 0: ordinal not in range(128)

The reason for this is Exception lacks an __unicode__ method
implementation so that unicode(e) does something like unicode(str(e))
which attempts to convert the exception arguments to the default
encoding (almost always ASCII) and fails.

Fixing this seems quite important. It's common to want to raise errors
with non-ASCII characters (e.g. when the data which caused the error
contains such characters). Usually the code raising the error has no way
of knowing how the characters should be encoded (exceptions can end up
being written to log files, displayed in web interfaces, that sort of
thing). This means raising exceptions with unicode messages. Using
unicode(e.message) is unattractive since it won't work in 3.0 and also
does not duplicate str(e)'s handling of the other exception __init__
arguments.

I'm attaching a patch which implements __unicode__ for BaseException.
Because of the lack of a tp_unicode slot to mirror tp_str slot, this
breaks the test that calls unicode(Exception). The existing test for
unicode(e) does unicode(Exception(u"Foo")) which is a bit of a non-test.
My patch adds a test of unicode(Exception(u'\xe1')) which fails without
the patch.

A quick look through trunk suggests implementing tp_unicode actually
wouldn't be a huge job. My worry is that this would constitute a change
to the C API for PyObjects and has little chance of acceptance into 2.6
(and in 3.0 all these issues disappear anyway). If there is some chance
of acceptance, I'm willing to write a patch that adds tp_unicode.

--
nosy: +hodgestar
Added file: http://bugs.python.org/file10559/exception-unicode.diff

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



[issue2517] Error when printing an exception containing a Unicode string

2008-06-09 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Concerning http://bugs.python.org/issue1551432:

I'd much rather have working unicode(e) than working unicode(Exception).
Calling unicode(C) on any class C which overrides __unicode__ is broken
without tp_unicode anyway.

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



[issue2517] Error when printing an exception containing a Unicode string

2008-06-09 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Benjamin Peterson wrote:
> What version are you using? In Py3k, str is unicode so __str__ can
> return a unicode string.

I'm sorry it wasn't clear. I'm aware that this issue doesn't apply to
Python 3.0. I'm testing on both Python 2.5 and Python 2.6 for the
purposes of the bug.

Code I'm developing that hits these issues are database exceptions with
unicode messages raised inside MySQLdb on Python 2.5.

The patch I submitted is against trunk.

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



[issue2517] Error when printing an exception containing a Unicode string

2008-06-11 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Attached a patch which implements Nick Coghlan's suggestion. All
existing tests in test_exceptions.py and test_unicode.py pass as does
the new unicode(Exception(u"\xe1")) test.

Added file: 
http://bugs.python.org/file10580/exception-unicode-with-type-fetch.diff

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



[issue2517] Error when printing an exception containing a Unicode string

2008-06-11 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Re msg67974:
> Minor cleanup of Simon's patch attached - aside from a couple of
> unneeded whitespace changes, it all looks good to me.
>
> Not checking it in yet, since it isn't critical for this week's beta
> release - I'd prefer to leave it until after that has been dealt with.

Thanks for the clean-up, Nick. The mixture of tabs and spaces in the
current object.c was unpleasant :/.

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



[issue2517] Error when printing an exception containing a Unicode string

2008-06-19 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Justing prodding the issue again now that the betas are out. What's the
next step?

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



[issue3161] Missing import for sys in _abcoll

2008-06-21 Thread Simon Cross

New submission from Simon Cross <[EMAIL PROTECTED]>:

The _hash method of the Set ABC uses sys.maxsize but doesn't import sys.
The attached patch (against trunk) imports sys and adds a test to show
the problem. There are also still some other _abcoll.py cleanups waiting
in issue 2226.

--
components: Library (Lib), Tests
files: abcoll-hash.diff
keywords: patch
messages: 68504
nosy: hodgestar
severity: normal
status: open
title: Missing import for sys in _abcoll
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file10682/abcoll-hash.diff

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



[issue3161] Missing import for sys in _abcoll

2008-06-21 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

One could also make a case for simply removing the _hash method since it
doesn't look like anything is using it? And anything that was using it
would already be broken?

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-06-21 Thread Simon Cross

New submission from Simon Cross <[EMAIL PROTECTED]>:

It appears that ssl.SSLSocket attempts to override some of the methods
socket.socket delegates to the underlying _socket.socket methods.
However, this overriding fails because socket.socket.__init__ replaces
all the methods mentioned in _delegate_methods.

These methods are: recv, recvfrom, recv_into, recvfrom_into, send and
sendto.

ssl.SSLSocket implements recv and send. Neither of these overrides will
actually work.  ssl.SSLSocket also implements recv_from and send_to
which seem to be attempts to override recvfrom and sendto.

In the Py3k branch it looks like the overriding done by
socket.socket.__init__ is gone so that these methods are now potentially
overridable. This could potentially be emulated in trunk by checking for
the methods using hasattr(...) before overriding them.

I'm happy to create patches which fix the method names and clean up the
methods on both branches and add tests. I just want to check that I have
an accurate picture of what's needed before starting on them.

--
components: Library (Lib)
messages: 68517
nosy: hodgestar
severity: normal
status: open
title: ssl.SSLSocket implements methods that are overriden by 
socket.socket.__init__ and methods with incorrect names.
versions: Python 2.6, Python 3.0

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



[issue1923] meaningful whitespace can be lost in rfc822_escape

2008-08-28 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

I've just checked that the patch still applies cleanly to 2.6 and it
does and the tests still passes. It looks like the patch has already
been applied to 3.0 but without the test. The test part of the part
applies cleanly to 3.0 too.

--
nosy: +hodgestar

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



[issue1923] meaningful whitespace can be lost in rfc822_escape

2008-09-03 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Poking the issue.

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-09-05 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

I've attached a patch for trunk / 2.6 that adds recv_into and
recvfrom_into methods to ssl.SSLSocket and does a minor re-ordering of
the nasty lambdas in __init__. The recv_into method is a port of the one
from 3.0. The recvfrom_into method is a simple "fail if we have an SSL
object or pass down if we don't".

For the record, I'm against the lambdas in SSLSocket.__init__ and would
prefer the solution I suggested previously of putting a hasattr(...)
check into socket.socket (I can submit a patch if useful).

As is probably abundantly clear at the moment :), none of the SSLSocket
methods in questions have tests in test_ssl -- I will move on to trying
to add them next.

I'm also going to attach a patch for 3.0 which adds recvfrom_into (a
port of the 2.6 one).

--
keywords: +patch
Added file: http://bugs.python.org/file11389/trunk-ssl-methods.patch

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-09-05 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Attach recvfrom_into method patch for 3.0.

Added file: http://bugs.python.org/file11390/3k-ssl-methods.patch

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-09-05 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Tests for recv* and send* methods in 3.0 (2.6 tests coming shortly).

Added file: http://bugs.python.org/file11392/3k-ssl-tests.patch

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-09-05 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Test for recv* and send* in 2.6.

The tests revealed some bugs so this patch fixes those and supercedes
trunk-ssl-methods.patch.

Of particular note is that recv_into called self.read(buf, nbytes) which
isn't supported in _ssl.c in 2.6. I've worked around it by creating a
temporary buffer in the Python code. This isn't great for large
messages, but the alternative is to modify _ssl.c itself (which I
suspect is unlikely to make it in to 2.6 at this stage).

Added file: http://bugs.python.org/file11393/trunk-ssl-tests.patch

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-09-05 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

>> self.read(buf, nbytes)

> Shouldn't this function be named readinto()?

There is no readinto function (and I suspect one is unlikely to be added
now). In Py3k SSLSocket.read takes both len and buffer as optional
arguments.

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-09-05 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

@Bill Janssen:

There are currently two patch sets which I think should be applied. For
2.6 it's just trunk-ssl-tests.patch. For 3.0 it's 3k-ssl-methods.patch
and 3k-ssl-tests.patch.

@Amaury Forgeot d'Arc

I agree it's not great nomenclature but that's a whole separate can of
worms and not one I want to open in this bug (and in any case, it has
practically zero hope of making it into 2.6/3.0 at this point).

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



[issue3162] ssl.SSLSocket implements methods that are overriden by socket.socket.__init__ and methods with incorrect names.

2008-09-08 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

And thanks for looking at them and applying! :)

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



[issue3823] ssl.wrap_socket() is incompatible with servers that drop privileges, due to keyfile requirement

2008-09-10 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

I've dug around in the code a bit and the keyfile, certfile and ca_certs
filename arguments to SSLSocket.__init__ are passed down into
newPySSLObject in _ssl.c and from there directly to SSL_CTX_* function
from OpenSSL so making these arguments allow file-like objects is going
to be non-trivial.

The options I see are:

* Write the file-like objects out to named temporary files and pass
those through to OpenSSL (seems like a nasty hack and prone to all sorts
of problems).

* Change the which OpenSSL functions are used to setup the certificate
(I definitely don't think this could go into 2.6 or 3.0 at this stage;
also see analysis of current OpenSSL usage below for more difficulties)

* Add an SSL CTX wrapper object and allow that to be passed down to
newPySSLObject instead of the filenames. Then the CTX object could be
created before dropping privileges (I think this is probably also too
big a change to be considered for 2.6 or 3.0 at this point, but it's
what looks best to me at the moment).

The current situation in _ssl.c:

* keyfile is loaded using SSL_CTX_use_PrivateKey_file(...) which loads
the first certificate from keyfile into ctx. We could replace this with
SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) but we'd have to
load the key ourselves and make sure to follow what OpenSSL does to
maintain compatibility.

* certfile is loaded with SSL_CTX_use_certificate_chain_file(...) which
reads in all the certificates from certfile into ctx. We could read the
certificates in ourselves and them load them one by one using
SSL_CTX_use_certificate(...) and then SSL_CTX_add_extra_chain_cert(...).

* ca_certs is loaded using SSL_CTX_load_verify_locations(...). As fasr
as I can see there is no convenient replacement function for this in
OpenSSL. SSL_CTX_set_client_CA_list(...) will load a list of certificate
names but doesn't load the certificates themselves (so verification
won't be done with them) and SSL_CTX_add_client_CA(...) has the same
issue.  

One could use SSL_CTX_set_cert_store(...) to register callbacks (and
then presumably one can do whatever one wants and can get around the
ca_certs issue) but the man page for SSL_CTX_set_cert_store has the
rather disheartening "Currently no detailed documentation on how to use
the X509_STORE object is available."

All this comes with the proviso that I just started digging into the
OpenSSL manpages today so I'm a long way from being an expert. :)

I can probably find time to create a patch with tests once we have a
clear direction to go in.

@Forest: If you have an details on how non-Python servers go about
loading certificates and then dropping privileges using OpenSSL, that
would be extremely useful.

--
nosy: +hodgestar

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



[issue3932] HTMLParser cannot handle '&' and non-ascii characters in attribute names

2008-09-26 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

I can't reproduce this on current trunk (r66633, 27 Sep 2008). I checked
sys.getdefaultencoding() but that returned 'ascii' as expected and I
even tried language Python with "LANG=C ./python" but that didn't fail
either. Perhaps this has been fixed? It looks like it might originally
have been a problem in the re module from the traceback.

--
nosy: +hodgestar

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



[issue3932] HTMLParser cannot handle '&' and non-ascii characters in attribute names

2008-10-03 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

I've tracked down the cause to the .unescape(...) method in HTMLParser.
The replaceEntities function passed to re.sub() always returns a unicode
character, even when matching string s is a byte string. Changing line
383 to:

  return self.entitydefs[s].encode("utf-8")

makes the test pass. Unfortunately this is obviously not a viable
solution in the general case. The problem is that there is no way to
know what character set to encode in without knowing both the HTTP
headers (which are not available to HTMLParser) and looking at the XML
and HTML headers.

Python 3.0 implicitly rejects non-unicode strings right at the start of
html.parser.HTMLParser.feed(...) by adding '' to the data passed in.

Given Python 3.0's behaviour, the docs should perhaps be updated to say
HTMLParser does not support non-unicode strings? If it should support
byte strings, we'll have to figure out how to handle encoded entity issues.

It's a bit weird that character and entity references outside
tags/attributes result in calls to .entityref(...) and .charref(...)
while those inside get unescape called automatically. Don't really see
what can be done about that though.

--
versions: +Python 2.7

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



[issue8158] documentation of 'optparse' module incomplete

2010-03-16 Thread Simon Anders

New submission from Simon Anders :

The class optparse.OptionParser supports a number of useful keyword arguments 
to the initializer, which are not documented in the Python Standard Library 
documentation, here: http://docs.python.org/library/optparse.html

This is a bit unfortunate. For example, I wanted to add a description to the 
top of my script's help page and a copyright notice to the foot, and was 
already about to subclass OptionParser in order to override the format_help 
method, when I noticed that optional keyword arguments 'description' and 
'epilog' are provided for precisely this purpose.

The 'epilog' attribute is at least mentioned in the class's docstring, while 
the 'description' argument is completely undocumented. I doubt that this was 
done on purpose.

I'd suggest to go over the documentation page for optparse and fill in the 
missing bits; at minimum, list all keyword arguments to 
optparse.OptionParser.__init__.

--
assignee: georg.brandl
components: Documentation
messages: 101177
nosy: georg.brandl, sanders
severity: normal
status: open
title: documentation of 'optparse' module incomplete
versions: Python 2.6

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



[issue8689] sqlite3 parameter substitution breaks with multiple parameters

2010-05-11 Thread Simon Jagoe

New submission from Simon Jagoe :

I have been using sqlalchemy and sqlamp in a project for a while with Python 
2.5.x and Python 2.6.4. With a recent upgrade to Python 2.6.5 (on Ubuntu Lucid 
Lynx), a particular operation began to fail when using sqlite.

I have tracked this to using the sqlite3 module and multiple parameter 
substitution. See below for a simple test case.

Set up the database:

 >>> import sqlite3
 >>> conn = sqlite3.connect('test.sqlite3')
 >>> c = conn.cursor()
 >>> c.execute('create table test (col integer)')
 >>> c.execute('insert into test values (1)')
 >>> conn.commit()

Actual result:

 >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1))
 >>> c.fetchone()
 (None,)

Expected result:

 >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1))
 >>> c.fetchone()
 (2,)

The expected result can be simulated like this:

 >>> c.execute('SELECT coalesce(max(test.col), 0) + 1 AS col FROM test')
 >>> c.fetchone()
 (2,)

--
messages: 105525
nosy: azriphale
priority: normal
severity: normal
status: open
title: sqlite3 parameter substitution breaks with multiple parameters
versions: Python 2.6

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



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-12-04 Thread Simon Anders

Simon Anders added the comment:

Update to the story: After I submitted the bug report to Intel, they
investigated and quickly confirmed it to be a compiler bug, whcih they
then managed to fix.

I have just got an e-mail from Intel that the newest available version
of ICC, namely version l_cc_c_10.1.008, contains the fix. 

In principle the problem should vanish now, but I have not found the
time to verify that.

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



[issue2074] pprint._safe_repr() unsafe on ordering differently types objects with same str represenation

2008-02-11 Thread Simon Percivall

New submission from Simon Percivall:

_safe_repr() tries to handle the case where two objects are unorderable by 
ordering on (str(type(key)), key, value), but this fails when 
str(type(key)) is equal for two objects, but key is different and 
unorderable. Easy fix: order just on the string representation.

--
components: Library (Lib)
files: pprint.diff
messages: 62303
nosy: percivall
severity: normal
status: open
title: pprint._safe_repr() unsafe on ordering differently types objects with 
same str represenation
versions: Python 3.0
Added file: http://bugs.python.org/file9413/pprint.diff

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



[issue2074] pprint._safe_repr() unsafe on ordering differently types objects with same str represenation

2008-03-18 Thread Simon Percivall

Changes by Simon Percivall <[EMAIL PROTECTED]>:


Added file: http://bugs.python.org/file9746/test_pprint30_bug.py

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



[issue2074] pprint._safe_repr() unsafe on ordering differently types objects with same str represenation

2008-03-18 Thread Simon Percivall

Simon Percivall <[EMAIL PROTECTED]> added the comment:

It's still a problem, as the test case demonstrates.

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



[issue2742] example code does not work

2008-05-10 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

This also affects Python 2.4 and 2.6 on Linux systems. Bug
http://bugs.python.org/issue2763 is a duplicate of this one.

The issue is that socketmodule.c doesn't convert empty strings to NULLs
before passing hptr through to the underlying system getaddrinfo(...).
The question is whether to fix the documentation and examples or the
socketmodule.c code.

--
nosy: +hodgestar
versions: +Python 2.4, Python 2.6

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



[issue2742] example code does not work

2008-05-10 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Attached a patch to correct the getaddrinfo(...) documentation and the
code example in socket.rst.

--
keywords: +patch
Added file: 
http://bugs.python.org/file10237/getaddrinfo-doesnt-treat-empty-string-as-none.diff

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



[issue2746] ElementTree ProcessingInstruction uses character entities in content

2008-05-10 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

cElementTree.ElementTree is a copy of ElementTree.ElementTree with the
.parse(...) method replaced, so the original patch for ElementTree
should fix cElementTree too.

The copying of the ElementTree class into cElementTree happens in the
call to boostrap in the init_elementtree() function at the bottom of
_elementtree.c.

--
nosy: +hodgestar

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



[issue2736] datetime needs and "epoch" method

2008-05-10 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Attached a patch which adds a .totimetuple(...) method to
datetime.datetime and tests for it.

The intention is that the dt.totimetuple(...) method is equivalent to:
mktime(dt.timetuple()) + (dt.microsecond / 100.0)

--
keywords: +patch
nosy: +hodgestar
Added file: 
http://bugs.python.org/file10251/add-datetime-totimestamp-method.diff

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



[issue2736] datetime needs and "epoch" method

2008-05-10 Thread Simon Cross

Simon Cross <[EMAIL PROTECTED]> added the comment:

Patch adding documentation for datetime.totimestamp(...).

Added file: 
http://bugs.python.org/file10256/add-datetime-totimestamp-method-docs.diff

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



[issue1491] BaseHTTPServer incorrectly implements response code 100

2008-05-11 Thread Simon Cross

Changes by Simon Cross <[EMAIL PROTECTED]>:


--
nosy: +hodgestar

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



[issue4446] Distutils Metadata Documentation Missing "platforms" Keyword

2008-11-27 Thread Simon Cross

New submission from Simon Cross <[EMAIL PROTECTED]>:

The section on Additional meta-data in Doc/distutils/setupscript.rst is
missing any reference to the setup() "platforms" keyword. I've attached
a patch which fills in the basics but there are some outstanding questions:

 - Does note (4) about backwards compatibility with earlier versions of
Python apply?

 - What strings should be used to describe each platform? Perhaps any
final element of an "Operating System ::" trove classifier?

 - Given that we have the classifiers, is the "platforms" keyword
actually needed? Perhaps the docs should just mark it as deprecated? We
would then maybe need to change distutils to populate the platforms key
in PKG-INFO from the classifiers?

--
assignee: georg.brandl
components: Documentation
files: distutils-platforms-keyword-documentation.diff
keywords: patch
messages: 76499
nosy: georg.brandl, hodgestar
severity: normal
status: open
title: Distutils Metadata Documentation Missing "platforms" Keyword
versions: Python 2.5, Python 2.5.3, Python 2.6, Python 2.7, Python 3.0, Python 
3.1
Added file: 
http://bugs.python.org/file12142/distutils-platforms-keyword-documentation.diff

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



[issue4336] Fix performance issues in xmlrpclib

2008-12-01 Thread Simon Cross

Changes by Simon Cross <[EMAIL PROTECTED]>:


--
nosy: +hodgestar

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



[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread simon mackenzie


New submission from simon mackenzie :

The docs for subprocess.run say "The arguments used to launch the process. This 
may be a list or a string."

This works in windows but in linux it has to be a list. Either needs fixing or 
the docs need to be changed.

--
messages: 349800
nosy: simon mackenzie
priority: normal
severity: normal
status: open
title: docs says subprocess.run  accepts a string but this does not work on 
linux

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



[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread simon mackenzie


simon mackenzie  added the comment:

Technically true but I am not the first person to have incorrectly
interpreted this that it can be a string which suggests it is not clear to
the reader. Maybe should be explicitly stated in the description of run as
it is not obvious or intuitive.

On Thu, 15 Aug 2019 at 13:47, SilentGhost  wrote:

>
> SilentGhost  added the comment:
>
> The only place this phrase appears is in CompletedProcess.args description
> and it is correct there. Whether args arguments of subprocess.run (or
> generally Popen) can be a list or a string is discussed in Frequently Used
> Arguments section, and it is perfectly clear from reading the text under
> which condition you can pass a string as args argument. I don't think
> anything needs fixing, both implementation and docs are correct.
>
> --
> assignee:  -> docs@python
> components: +Documentation
> nosy: +SilentGhost, docs@python
> type:  -> behavior
>
> ___
> Python tracker 
> <https://bugs.python.org/issue37867>
> ___
>

--
title: docs says subprocess.run  accepts a string but this does not work on 
linux -> docs says subprocess.run accepts a string but this does not work on 
linux

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



[issue37867] docs says subprocess.run accepts a string but this does not work on linux

2019-08-15 Thread simon mackenzie


simon mackenzie  added the comment:

Would be clearer if the arguments were listed before the return object.

On Thu, 15 Aug 2019 at 15:05, SilentGhost  wrote:

>
> SilentGhost  added the comment:
>
> But docs don't say that at all. You're looking at description of an
> attribute of returned object. And of course it can be a string, under
> certain conditions. The attributes of CompletedProcess and function
> arguments are described in the standard way, and I haven't heard of anyone
> mixing the two before.
>
> --
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> <https://bugs.python.org/issue37867>
> ___
>

--

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



[issue43967] Valgrind memcheck on Py_Initialize

2021-04-28 Thread Simon Aldrich


New submission from Simon Aldrich :

Running a Valgrind memcheck of Py_Initialize still produces issues even when 
using the suggested suppressions file. Am I doing something wrong or is this 
expected?

I've attached a simple reproducer which can be run as follows:

1. Extract tarball
2. cmake
3. make memcheck (runs valgrind with suppressions)

Gives output similar to:

[100%] Built target valgrind-libpython
==2901== Memcheck, a memory error detector
==2901== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2901== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==2901== Command: ./valgrind-libpython
==2901== 
==2901== Conditional jump or move depends on uninitialised value(s)
==2901==at 0x5729DB7: __wcsnlen_avx2 (strlen-avx2.S:264)
==2901==by 0x5657CA1: wcsrtombs (wcsrtombs.c:104)
==2901==by 0x55DDC40: wcstombs (wcstombs.c:34)
==2901==by 0x4FB7EB9: _Py_EncodeLocaleRaw (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FB99F7: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FBB8B2: _PyPathConfig_Calculate (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FDAC8D: _PyConfig_InitPathConfig (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE4F6E: PyConfig_Read (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE687A: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE79A1: Py_InitializeFromConfig (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE7A5B: Py_InitializeEx (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x108758: main (in 
/home/simon/temp/valgrind-libpython/build/valgrind-libpython)
==2901== 
==2901== Conditional jump or move depends on uninitialised value(s)
==2901==at 0x55C14E8: internal_utf8_loop (loop.c:298)
==2901==by 0x55C14E8: __gconv_transform_internal_utf8 (skeleton.c:609)
==2901==by 0x5657CD4: wcsrtombs (wcsrtombs.c:110)
==2901==by 0x55DDC40: wcstombs (wcstombs.c:34)
==2901==by 0x4FB7EB9: _Py_EncodeLocaleRaw (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FB99F7: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FBB8B2: _PyPathConfig_Calculate (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FDAC8D: _PyConfig_InitPathConfig (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE4F6E: PyConfig_Read (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE687A: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE79A1: Py_InitializeFromConfig (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x4FE7A5B: Py_InitializeEx (in 
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==by 0x108758: main (in 
/home/simon/temp/valgrind-libpython/build/valgrind-libpython)...

--
components: C API, Library (Lib)
files: valgrind-libpython.tar.gz
messages: 392199
nosy: simonaldrich
priority: normal
severity: normal
status: open
title: Valgrind memcheck on Py_Initialize
type: security
versions: Python 3.8
Added file: https://bugs.python.org/file49996/valgrind-libpython.tar.gz

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



[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-08 Thread Simon Willison


New submission from Simon Willison :

In Python 3.10 it is not possible to instantiate an asyncio.Condition that 
wraps an asyncio.Lock without raising a "loop argument must agree with lock" 
exception.

This code raises that exception:

asyncio.Condition(asyncio.Lock())

This worked in previous Python versions.

Note that the error only occurs if an event loop is running. Here's a simple 
script that replicates the problem:

import asyncio

# This runs without an exception:
print(asyncio.Condition(asyncio.Lock()))

# This does not work:
async def example():
print(asyncio.Condition(asyncio.Lock()))

# This raises "ValueError: loop argument must agree with lock":
asyncio.run(example())

--
components: asyncio
messages: 403500
nosy: asvetlov, simonw, yselivanov
priority: normal
severity: normal
status: open
title: "loop argument must agree with lock" instantiating asyncio.Condition
versions: Python 3.10

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



[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-08 Thread Simon Willison


Simon Willison  added the comment:

I ran across this issue while trying to use the https://pypi.org/project/janus/ 
locking library with Python 3.10 - see my issue on their tracker here: 
https://github.com/aio-libs/janus/issues/358

--

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



  1   2   3   >