[issue46956] TextIOWrapper.seek silently wraps around on very large offsets

2022-03-08 Thread Zsolt Cserna


Change by Zsolt Cserna :


--
nosy: +csernazs

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



[issue35297] untokenize documentation is not correct

2018-11-22 Thread Zsolt Cserna


Change by Zsolt Cserna :


--
versions: +Python 3.6

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



[issue35297] untokenize documentation is not correct

2018-11-22 Thread Zsolt Cserna


New submission from Zsolt Cserna :

untokenize documentation 
(https://docs.python.org/3/library/tokenize.html#tokenize.untokenize) states 
the following:

"""
Converts tokens back into Python source code. The iterable must return 
sequences with at least two elements, the token type and the token string. Any 
additional sequence elements are ignored.
"""

This last sentence is clearly not true because here:
https://github.com/python/cpython/blob/master/Lib/tokenize.py#L242

The code checks for the length of the input token there, and the code behaves 
differently, in terms of whitespace, when an iterator of 2-tuples are given and 
when there are more elements in the tuple. When there are more elements in the 
tuple, the function renders whitespaces as the same as they were present in the 
original source.

So this code:
tokenize.untokenize(tokenize.tokenize(source.readline))

And this:
tokenize.untokenize([x[:2] for x in tokenize.tokenize(source.readline)])

Have different results.

I don't know that it is a documentation issue  or a bug in the module itself, 
so I created this bugreport to seek for assistance in this regard.

--
assignee: docs@python
components: Documentation
messages: 330281
nosy: csernazs, docs@python
priority: normal
severity: normal
status: open
title: untokenize documentation is not correct
versions: Python 3.7

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



[issue34260] shutil.copy2 is not the same as cp -p

2018-10-25 Thread Zsolt Cserna


Zsolt Cserna  added the comment:

Thanks for your help! :)

--

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



[issue34260] shutil.copy2 is not the same as cp -p

2018-10-23 Thread Zsolt Cserna


Change by Zsolt Cserna :


--
pull_requests: +9405

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



[issue34260] shutil.copy2 is not the same as cp -p

2018-10-23 Thread Zsolt Cserna


Change by Zsolt Cserna :


--
pull_requests: +9404

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



[issue34260] shutil.copy2 is not the same as cp -p

2018-10-23 Thread Zsolt Cserna


Change by Zsolt Cserna :


--
pull_requests: +9401

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



[issue34248] dbm errors should contain file names

2018-07-31 Thread Zsolt Cserna


Zsolt Cserna  added the comment:

Alright, I created a PR for this. We will see if this can be merged to upstream 
or not.

--

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



[issue34248] dbm errors should contain file names

2018-07-31 Thread Zsolt Cserna


Change by Zsolt Cserna :


--
pull_requests: +8100
stage:  -> patch review

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



[issue34248] dbm errors should contain file names

2018-07-31 Thread Zsolt Cserna


Zsolt Cserna  added the comment:

I've made a patch which works for me.

>>> dbm.gnu.open("/tmp/z")
Traceback (most recent call last):
  File "", line 1, in 
_gdbm.error: [Errno 2] No such file or directory: '/tmp/z'
>>> 


Could you please give it a try?

--
keywords: +patch
nosy: +csernazs
Added file: https://bugs.python.org/file47724/patch.diff

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



[issue34299] argparse description formatting

2018-07-31 Thread Zsolt Cserna


Zsolt Cserna  added the comment:

You would need to use the RawTextHelpFormatter as format_class for the 
constructor. In this case, argparse will apply no re-wrapping of the 
description.

import argparse

parser = argparse.ArgumentParser(description="""foo
bar
baz""", formatter_class=argparse.RawTextHelpFormatter)

--
nosy: +csernazs

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



[issue34260] shutil.copy2 is not the same as cp -p

2018-07-28 Thread Zsolt Cserna


New submission from Zsolt Cserna :

The docstring of shutil.copy2 says the following:

Copy data and all stat info ("cp -p src dst").

This can be misleading as it is not the same as 'cp -p', as it does not copy 
the file owner (uid and gid). That would need to have a chown() call to be 
made, which is currently not called unavailable.

I would like to have the documentation fixed by adding that it does not copies 
file owner and group.

--
components: Library (Lib)
messages: 322551
nosy: csernazs
priority: normal
severity: normal
status: open
title: shutil.copy2 is not the same as cp -p
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue18808] Thread.join returns before PyThreadState is destroyed

2013-09-02 Thread Zsolt Cserna

Changes by Zsolt Cserna zsolt.cse...@morganstanley.com:


--
nosy: +csernazs

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18808
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9253] argparse: optional subparsers

2011-08-22 Thread Zsolt Cserna

Changes by Zsolt Cserna zsolt.cse...@morganstanley.com:


--
nosy: +csernazs

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9253
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9100] test_sysconfig fails (test_user_similar)

2011-03-03 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

No, I think it's not the duplicate of any of the bugs you've specified.
Meanwhile I've installed to another location and it's now python 2.7.1, but the 
problem still present:

My configure parameters are:
--prefix=//ms/dist/python/PROJ/core/2.7.1-1/common 
--exec-prefix=//ms/dist/python/PROJ/core/2.7.1-1/.exec/ia32.linux.2.6.glibc.2.3 
--enable-shared

The error message is:

AssertionError: '/ms/user/a/and/.local/lib/python2.7' != 
'/ms/user/a/and/.local/exec/lib/python2.7'

I'm executing the python interpreter from:
//ms/dist/python/PROJ/core/2.7.1/exec/bin/python

(which is the same as 
//ms/dist/python/PROJ/core/2.7.1-1/.exec/ia32.linux.2.6.glibc.2.3/bin/python)

In the unittest I have the following variables:
sysconfig.get_config_var('base') = '/ms/dist/python/PROJ/core/2.7.1'
sysconfig.get_config_var('userbase') = '/ms/user/a/and/.local'
sysconfig.get_path('stdlib', 'posix_prefix') = 
'/ms/dist/python/PROJ/core/2.7.1/lib/python2.7'
sysconfig.get_path('stdlib', 'posix_user') = 
'/ms/user/a/and/.local/lib/python2.7'
sysconfig.get_path('platstdlib', 'posix_prefix') = 
'/ms/dist/python/PROJ/core/2.7.1/exec/lib/python2.7'
sysconfig.get_path('platstdlib', 'posix_user') = 
'/ms/user/a/and/.local/lib/python2.7'
sysconfig.get_path('purelib', 'posix_prefix') = 
'/ms/dist/python/PROJ/core/2.7.1/lib/python2.7/site-packages'
sysconfig.get_path('purelib', 'posix_user') = 
'/ms/user/a/and/.local/lib/python2.7/site-packages'
sysconfig.get_path('platlib', 'posix_prefix') = 
'/ms/dist/python/PROJ/core/2.7.1/exec/lib/python2.7/site-packages'
sysconfig.get_path('platlib', 'posix_user') = 
'/ms/user/a/and/.local/lib/python2.7/site-packages'

I think the problem is that while get_path('platstdlib', 'posix_prefix') 
returns an exec-specific path different from get_path('stdlib', 
'posix_prefix'), get_path('platstdlib', 'posix_user') returns the same as 
get_path('stdlib', 'posix_user').

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9100
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9115] test_site: support for systems without unsetenv

2011-01-03 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I confirm that this patch fixes the problem. Thanks.

On my systems I haven't seen other bugs related to unsetenv - however, it might 
be useful to fix subprocess.Popen and subprocess.call to use the os.environ by 
default (but this would be another request or discussion).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5625] test_urllib2 fails - urlopen error file not on local host

2010-12-15 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

Could you please add this change to test_urllib2.py as well?

It has the following line:
localaddr = socket.gethostbyname(socket.gethostname())

But urllib2.py has the change related to this bug.
That makes test_urllib2 failing when gethostbyname reports different IP than 
gethostbyname_ex:

(Pdb) socket.gethostbyname_ex(socket.gethostname())[2]
['172.31.92.26']
(Pdb) socket.gethostbyname(socket.gethostname())
'172.31.72.206'

--
nosy: +csernazs

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5625
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5625] test_urllib2 fails - urlopen error file not on local host

2010-12-15 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

The test which failed was HandlerTests.test_file, and I'm using python 2.7.1.

socket.gethostbyname('localhost') returns 127.0.0.1 which is ok, but in the 
unittest it's already tested (line 671).

The problem is that my /etc/hosts file contains a different IP than the DNS (I 
cannot change this behaviour as I'm not the administrator of the host) and 
that's the difference between gethostbyname and gethostbyname_ex.

The unittest creates an url which is not local (from urllib2 point of view). 
I'm attaching a patch which has fixed my problem.

--
keywords: +patch
Added file: http://bugs.python.org/file20050/test_urllib2.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5625
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5625] test_urllib2 fails - urlopen error file not on local host

2010-12-15 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

The order of the IP addresses doesn't matter as urllib2 is flexible enough to 
handle all local IP addresses as local (that was the original bug - it handled 
only one IP returned by gethostbyname which returned a random IP if there were 
more than one).

So picking up the first IP is ok I think as the order of the IP addresses 
doesn't matter - urllib2 will handle all of them as local.
See urllib2.FileHandler.get_names().

The problem is that gethostbyname doesn't guarantee that it returns one IP 
address from the set returned by gethostbyname_ex as gethostbyname looks up the 
name in /etc/hosts file first (or as configured in NSS).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5625
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9185] os.getcwd causes infinite loop on solaris

2010-07-19 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I confirm that test_posix passes after applying the patch issue9185-2.patch on 
solaris 8.
Thank you. Now solaris and openbsd have a clean os.getcwd() implementation.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9185
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9185] os.getcwd causes infinite loop on solaris

2010-07-07 Thread Zsolt Cserna

New submission from Zsolt Cserna zsolt.cse...@morganstanley.com:

os.getcwd() causes infinite loop on solaris10 when the length of the current 
directory is greater than 1024 (them limit of the maximum absolute path).

os.getcwd is implemented by a while loop in python, see the function 
posix_getcwd in posixmodule.c. That while loop loops forever because on solaris 
it sets errno to ERANGE and res to NULL - even if there will be no positive 
results from getcwd due to the extra long path.
This infinite while cycle also causes eating up the memory.

I think the solution would be implementing a hard limit for this while loop. It 
could be either fixed (16k for example), or dymanic: comparing the MAXPATHLEN 
macro to the size of the allocated buffer and if the size of the buffer is 
greater than MAXLPATHLEN then raise an OSError exception with the current errno.

That bug was triggered by test_posix unittest.

--
components: Library (Lib)
messages: 109459
nosy: csernazs
priority: normal
severity: normal
status: open
title: os.getcwd causes infinite loop on solaris
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9185
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9185] os.getcwd causes infinite loop on solaris

2010-07-07 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

There would be also a solution to allocate a fix buffer with MAXLPATHLEN  size 
and call the getcwd function only one time - if MAXLPATHLEN is available.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9185
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9185] os.getcwd causes infinite loop on solaris

2010-07-07 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

You are right, but this bug could be easily avoided by using one of the 
suggested solutions. In my experience a fix sized buffer (whose size is 
MAXLPATHLEN - or 1024 if not defined) is usually passed to getcwd and the errno 
is propagated back to the caller if the result is NULL.

While getcwd() is buggy on solaris I think it's not the correct behavior from 
python to get to an infinite loop and eat up the memory.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9185
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8799] Hang in lib/test/test_threading.py

2010-06-29 Thread Zsolt Cserna

Changes by Zsolt Cserna zsolt.cse...@morganstanley.com:


--
nosy: +csernazs

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8799
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9115] test_site: support for systems without unsetenv

2010-06-29 Thread Zsolt Cserna

New submission from Zsolt Cserna zsolt.cse...@morganstanley.com:

On systems where there's no unsetenv function (for example solaris 8), 
test_site fails because the PYTHONUSERBASE environment variable remains set to 
xoxo (set in the previous tests).

This results a failed test_s_option test.

--
components: Tests
files: test_site.py.diff
keywords: patch
messages: 108910
nosy: csernazs
priority: normal
severity: normal
status: open
title: test_site: support for systems without unsetenv
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file17799/test_site.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9115
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9100] test_sysconfig fails (test_user_similar)

2010-06-28 Thread Zsolt Cserna

New submission from Zsolt Cserna zsolt.cse...@morganstanley.com:

Python 2.7rc2

test_user_similar test in test_sysconfig fails for me. I think it's because I 
have different --exec-prefix and --prefix specified. The test assumes that 
get_config_var('base') is the part of the global_path = get_path('platstdlib', 
'posix_prefix') which is not necessarily true.

I've attached the pdb output containing the variable names.

--
components: Tests
files: pdb_test_user_similar.txt
messages: 108828
nosy: csernazs
priority: normal
severity: normal
status: open
title: test_sysconfig fails (test_user_similar)
versions: Python 2.7
Added file: http://bugs.python.org/file17789/pdb_test_user_similar.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9100
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7839] Popen should raise ValueError if pass a string when shell=False or a list when shell=True

2010-06-08 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I would say that both string and list should be accepted in args, and depending 
on the shell parameter, the module should create a list or a string from the 
specified list/string.

We already have a list2cmdline function to convert a list to string, we would 
only need to create the inverse of this function to convert a string to a list.

Executing a program whose parameters are coming from external source (eg. user 
input) can result security problems if those are not specified as a list and in 
this case I would be really happy to specify my parameters as a list to Popen 
and it would do the appropriate conversions as above.

--
nosy: +csernazs

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7839
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2010-02-26 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

There's a bundled unittest in test_httpservers which actually fails if this 
patch is not applied.

See the unittest attached. Unfortunatelly RuntimError is raised in the child 
process after fork() so I cannot re-raise it to the parent, instead I send a 
message from the child to the parent via a pipe if the child is ok.

--
Added file: http://bugs.python.org/file16378/thread_unittest.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2010-02-26 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I've run unittest with both patched and vanilla versions of python 2.6.4 and I 
confirm that it fails when it's run by vanilla on solaris 8, but passes on the 
patched version.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7906] float(INFI) returns inf on certain platforms

2010-02-12 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

This issue doesn't seem to cause any problems in our production code, however I 
haven't tested it.

Btw what is the status of the solaris support? According to wiki page it should 
be supported by python, in real it seems it's not really supported (I mean not 
just this bug, but others related to solaris).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7906
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7906] float(INFI) returns inf on certain platforms

2010-02-11 Thread Zsolt Cserna

New submission from Zsolt Cserna zsolt.cse...@morganstanley.com:

Python 2.6.4
On my system which is solaris 8/sparc, float(INFI) returns inf instead of 
raising ValueError, both 32 and 64-bit. (since it's case-insensitive it applies 
to any upper/lower combination of letters).

This issue breaks test_float regression test which has a test for that value 
and it expects ValueError.

Doing some research and debugging showed me that strtod(const char *str, char 
**endptr) function behaves differently on solaris 8 than linux.
On solaris it stores \0 in **endptr meaning that it processed the string 
completely - and that's the reason why python doesn't raise ValueError.
On linux, strtod() stores 'I' in **endptr, and it results the ValueError.

With python 2.6.1 there's no such issue.

--
components: Interpreter Core
messages: 99206
nosy: csernazs
severity: normal
status: open
title: float(INFI) returns inf on certain platforms
type: behavior
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7906
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1471934] Python libcrypt build problem on Solaris 8, 9, 10 and OpenSolaris

2010-02-11 Thread Zsolt Cserna

Changes by Zsolt Cserna zsolt.cse...@morganstanley.com:


--
nosy: +csernazs

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1471934
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7906] float(INFI) returns inf on certain platforms

2010-02-11 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I was not able to compile 3.1.1 due to issue6236, but with 2.7a3 it raises the 
expected ValueError, which is correct.

Is there any chance to get those changes you mentioned backported to 2.6?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7906
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2010-01-26 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

Ok, here's the new patch. I've removed the #ifdef-#endif lines. It passed the 
test thread_test.py on linux (and as well on solaris).

--
Added file: http://bugs.python.org/file16011/patch_2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2010-01-25 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I compile it with -lpthread.
os.fork1() was not available by default, I enabled it by removing two lines 
from posixmodule.c (it seems it's only enabled when #if defined(__USLC__)  
defined(__SCO_VERSION__) is true).

With os.fork1() I have the same results, RuntimeError.

I was not able to compile it without pthread because I haven't found any 
configure options for that. If it's possible I'm happy to try it.

In my patch I wanted to reduce the effect on systems where forking in thread is 
working (eg. linux), that's the reason why I added (defined (__SVR4)  
defined (__sun). But it just checks for solaris, not the OS version (on 
solaris 10/intel my demo is working).

(btw forking in thread  actually happens in a unittest related to 
BaseHTTPServer, which obviously fails on my platform)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2009-11-09 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

Additional info:
I've tested it on solaris 10 / sparc 32-bit, and my test script runs
fine on that.
Based on my test it seems that this bug does not affect solaris 10.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2009-11-02 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I've tested it only on solaris 8, 32-bit.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2009-11-02 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

solaris 10 x86, 32-bit, sun-studio 11 is ok (in this case the parent's
thread has thread_id=2 and the child inherits this id)
solaris 8 sparc4, 32-bit, sun-studio 11 is not working

So it seems it's independent from sun-cc but depends from the
architecture and/or the OS.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2009-11-02 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

I've attached a patch which seems to fix this issue. It sets
import_lock_thread to the current thread id after forking in the child
process, but still I'm not quite sure that it's the correct way of
solving this issue.

--
keywords: +patch
Added file: http://bugs.python.org/file15247/patch_1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2009-10-30 Thread Zsolt Cserna

New submission from Zsolt Cserna zsolt.cse...@morganstanley.com:

Python 2.6.4 (r264:75706, Oct 29 2009, 12:00:12) [C] on sunos5

On my sunos5 system if I call os.fork() in a thread created by
thread.start_new_thread(), it raises RuntimeError with the message 'not
holding the import lock'. It's a vanilla python compiled on sunos5 with
suncc. In 2.6.3 it's ok, I think this issue is caused by patch located
at http://codereview.appspot.com/96125/show.

The problem can be re-produced by running the script attached.

I've looked into the source and it seems to me the following:

Based on the the change above, it calls fork1() system call between a
lock-release calls:

3635 » _PyImport_AcquireLock();
3636 » pid = fork1();
3637 » result = _PyImport_ReleaseLock();

_PyImport_ReleaseLock is called in both the child and parent. Digging
more into the code, _PyImport_ReleaseLock starts with the following:

long me = PyThread_get_thread_ident();
if (me == -1 || import_lock == NULL)
return 0; /* Too bad */
if (import_lock_thread != me)
return -1;

In the above code, if I interpret correctly, it compares the result of
the current thread id returned by PyThread_get_thread_ident call with
the thread id of the thread holding the lock - if it's different then
the current thread cannot release the lock because it's not owned by it.

Based on my results on solaris the 'me' variable will be different in
the parent and in the child (in parent it remains the same) - resulting
that the child thinks that it's not holding the release lock.

I'm using pthreads on both linux and solaris. On linux the code above is
working fine, but on solaris it behaves differently.

--
components: Library (Lib)
files: thread_test.py
messages: 94701
nosy: csernazs
severity: normal
status: open
title: Forking in a thread raises RuntimeError
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file15232/thread_test.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2009-10-30 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

Sorry, the working version is not 2.6.3 (I mistyped the version), it's
2.6.1 (I've no info about 2.6.2).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7230] test_hotshot fails on solaris

2009-10-28 Thread Zsolt Cserna

New submission from Zsolt Cserna zsolt.cse...@morganstanley.com:

On sparc/solaris 5.8, test_hotshot fails:

csern...@localhost:/tmp/python2.6$ LD_LIBRARY_PATH=/tmp/python2.6
./python -E -tt ./Lib/test/regrtest.py -v -l test_hotshot

test_hotshot
test_addinfo (test.test_hotshot.HotShotTestCase) ... ok
test_bad_sys_path (test.test_hotshot.HotShotTestCase) ... ok
test_line_numbers (test.test_hotshot.HotShotTestCase) ... ok
test_logreader_eof_error (test.test_hotshot.HotShotTestCase) ... FAIL
test_start_stop (test.test_hotshot.HotShotTestCase) ... ok

==
FAIL: test_logreader_eof_error (test.test_hotshot.HotShotTestCase)
--
Traceback (most recent call last):
  File /tmp/python2.6/Lib/test/test_hotshot.py, line 130, in
test_logreader_eof_error
self.assertRaises((IOError, EOFError), _hotshot.logreader, .)
AssertionError: (type 'exceptions.IOError', type
'exceptions.EOFError') not raised

--
Ran 5 tests in 0.037s

FAILED (failures=1)
test test_hotshot failed -- Traceback (most recent call last):
  File /tmp/python2.6/Lib/test/test_hotshot.py, line 130, in
test_logreader_eof_error
self.assertRaises((IOError, EOFError), _hotshot.logreader, .)
AssertionError: (type 'exceptions.IOError', type
'exceptions.EOFError') not raised

1 test failed:
test_hotshot

From test_hotshot.py:

def test_logreader_eof_error(self):
self.assertRaises((IOError, EOFError), _hotshot.logreader, .)
gc.collect()

If I run python command-line interpreter, it doesn't raise exception:

 import _hotshot
 _hotshot.logreader(.)
_hotshot.LogReaderType object at 0x3f260
 

On intel/linux, this test passes.

--
components: Library (Lib)
messages: 94628
nosy: csernazs
severity: normal
status: open
title: test_hotshot fails on solaris
type: compile error
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7230
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4161] test_urllib fails with ValueError

2008-10-21 Thread Zsolt Cserna

New submission from Zsolt Cserna [EMAIL PROTECTED]:

test_urllib regression test fails with ValueError on linux (kernel 2.4,
glibc 2.3):

test_urllib
test test_urllib failed -- Traceback (most recent call last):
  File /tmp/x/Lib/test/test_urllib.py, line 112, in tearDown
for k, v in self._saved_environ:
ValueError: too many values to unpack

I think the fix is trivial, but I've attached the patch.

If this bug has been already fixed, sorry for reporting it.

--
files: test_urllib.patch
keywords: patch
messages: 75031
nosy: csernazs
severity: normal
status: open
title: test_urllib fails with ValueError
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file11846/test_urllib.patch

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