[issue11048] "import ctypes" causes segfault on read-only filesystem

2011-01-30 Thread Marcin Bachry

Marcin Bachry  added the comment:

This patch fixes issue with unitialized variable which makes ctypes crash in 
error handler.

Note that for you it merely turns "Segmentation fault" into MemoryError 
exception.  Python ships with buggy version of libffi, which tries to allocate 
memory using mmap() over a temporary file (the one seen in strace output above) 
instead of just doing mmap(MAP_ANONYMOUS|MAP_PRIVATE).  The bug is fixed in 
this libffi commit:

  
https://github.com/atgreen/libffi/commit/eaf444eabc4c78703c0f98ac0197b1619c1b1bef

Until Python's libffi is updated, you can do "mount -t tmpfs none /dev/shm".  
It's good to have "tmpfs" mounted anyway, just like "proc" and "sysfs".

--
keywords: +patch
nosy: +marcin.bachry
Added file: http://bugs.python.org/file20619/ctypes-erofs-crash.diff

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



[issue11158] Python VM deadlock

2011-02-10 Thread Marcin Bachry

Marcin Bachry  added the comment:

I think it may be related to this bug: http://bugs.python.org/issue6721

--
nosy: +marcin.bachry
status: pending -> open

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



[issue4066] smtplib SMTP_SSL._get_socket doesn't return a value

2008-10-07 Thread Marcin Bachry

New submission from Marcin Bachry <[EMAIL PROTECTED]>:

SMTP.connect method expects _get_socket() method to return socket object:

  self.sock = self._get_socket(host, port, self.timeout)

but overriden _get_socket() method in SMTP_SSL class doesnt' have return
statement (it sets self.sock instead).  Hence I get
SMTPServerDisconnected exception when I try to send mail over ssl.

The same seems to apply to LMTP class.

--
components: Library (Lib)
files: smtplib.diff
keywords: patch
messages: 74452
nosy: marcin.bachry
severity: normal
status: open
title: smtplib SMTP_SSL._get_socket doesn't return a value
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file11729/smtplib.diff

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



[issue4067] ast.fix_missing_locations() breaks if node doesn't have "_attributes" variable

2008-10-07 Thread Marcin Bachry

New submission from Marcin Bachry <[EMAIL PROTECTED]>:

ast.fix_missing_locations() fails if any node is missing "_attributes"
instance variable - but it's the case of some fundamental nodes like
"alias" or "identifier".  When I run simple test:

  import ast
  with open(__file__) as fp:
  tree = ast.parse(fp.read())
  ast.fix_missing_locations(tree)

I get:

  $ python2.6 /tmp/test.py 
  Traceback (most recent call last):
File "/tmp/test.py", line 5, in 
  ast.fix_missing_locations(tree)
File "/usr/local/lib/python2.6/ast.py", line 133, in
fix_missing_locations
  _fix(node, 1, 0)
File "/usr/local/lib/python2.6/ast.py", line 132, in _fix
  _fix(child, lineno, col_offset)
File "/usr/local/lib/python2.6/ast.py", line 132, in _fix
  _fix(child, lineno, col_offset)
File "/usr/local/lib/python2.6/ast.py", line 121, in _fix
  if 'lineno' in node._attributes:
  AttributeError: 'alias' object has no attribute '_attributes'

--
components: Library (Lib)
files: ast.diff
keywords: patch
messages: 74453
nosy: marcin.bachry
severity: normal
status: open
title: ast.fix_missing_locations() breaks if node doesn't have "_attributes" 
variable
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file11730/ast.diff

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



[issue7736] ctypes freezes/deadlocks process

2010-01-19 Thread Marcin Bachry

Marcin Bachry  added the comment:

Here's the backtrace:

#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1  0x7fcd0234a6e8 in PyThread_acquire_lock (lock=0x183f3f0, waitflag=128) 
at Python/thread_pthread.h:349
#2  0x7fcd02311fa4 in PyEval_RestoreThread (tstate=0x17a9b00) at 
Python/ceval.c:356
#3  0x7fcd02336a28 in PyGILState_Ensure () at Python/pystate.c:592
#4  0x7fcd013fcec1 in _CallPythonObject (cif=0x183f3f0, resp=0x80, 
args=0x7fccff153f40, userdata=)
at /home/marcin/Desktop/python/python2.x-hg/Modules/_ctypes/callbacks.c:220
#5  closure_fcn (cif=0x183f3f0, resp=0x80, args=0x7fccff153f40, userdata=)
at /home/marcin/Desktop/python/python2.x-hg/Modules/_ctypes/callbacks.c:374
#6  0x7fcd014044f0 in ffi_closure_unix64_inner (closure=, rvalue=, reg_args=0x246, argp=0x0)
at 
/home/marcin/Desktop/python/python2.x-hg/Modules/_ctypes/libffi/src/x86/ffi64.c:566
#7  0x7fcd01404b68 in ffi_closure_unix64 () at 
/home/marcin/Desktop/python/python2.x-hg/Modules/_ctypes/libffi/src/x86/unix64.S:230
#8  0x7fccff572429 in ?? () from /lib/libfuse.so.2
#9  0x7fccff5704fa in fuse_session_loop () from /lib/libfuse.so.2
#10 0x7fccff1576e4 in ?? ()
#11 0x7fccff154188 in ?? ()
#12 0x7fccff3580e0 in ?? ()
#13 0x0192e2f0 in ?? ()
#14 0x0004 in ?? ()
#15 0x0001 in ?? ()
#16 0x016ff5e0 in ?? ()
#17 0x0001 in ?? ()
#18 0x in ?? ()

All calls to native POSIX functions seem to be wrapped with 
Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS except of opendir() and closedir(). 
When I fix it (as in attached patch), call_hello.py doesn't block anymore.

--
keywords: +patch
nosy: +marcin.bachry
Added file: http://bugs.python.org/file15953/posix-opendir-and-gil.diff

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Marcin Bachry

Marcin Bachry  added the comment:

> Still, I'd be extremly grateful if someone could tell me the trick how 
to create a backtrace in such a deadlock situation

Sorry, I should have mentioned that. In order to get backtrace you let the 
process freeze, attach gdb to it (it will freeze too), then go to 
/sys/fs/fuse/connections/ and find your fuse connection (it's most likely the 
one with non-zero value in "waiting" file). Then do "echo 1 > abort" and go 
back to gdb.

--

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



[issue7760] use_errno=True does not work

2010-01-23 Thread Marcin Bachry

Marcin Bachry  added the comment:

In the libc case you shouldn't give absolute path in CDLL: CDLL('libc.so.6') is 
better. You use "/lib/libc.so.6" path, but Python (and ctypes.so) actually uses 
something like "/lib/tls/i686/cmov/libc.so.6" - these are two separate 
libraries with separate "errno" variables, mapped to different memory regions. 
Your call to getxattr modifies errno in the former library, but ctypes 
get_errno() fetches value from the latter library.

If I fix CDLL() call, the test works ok for me.

--
nosy: +marcin.bachry

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



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry  added the comment:

I think the expression "cur + step" in line 2660 of listobject.c (py2.7 trunk) 
overflows to negative value and the "if" branch isn't entered.

  if (cur + step >= Py_SIZE(self)) {
lim = Py_SIZE(self) - cur - 1;
   }

If I change the type of "cur" variable to unsigned int, the bug disappears. I 
don't know if it's ok to have unsigned "cur" here though - but I feel it is.

--
keywords: +patch
nosy: +marcin.bachry
Added file: http://bugs.python.org/file16015/maybe-a-fix.diff

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



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry  added the comment:

Using "grep" I found the same code in Modules/arraymodule.c:

  from array import array
  del array('i', range(10))[9::1<<333]

--

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



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry  added the comment:

Yes, I can give a shot.

--

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



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry  added the comment:

I attach the patch. I changed signedness in all three sequence types and made 
sure tests crash when run on unpatched Python.

--
Added file: http://bugs.python.org/file16019/fix.diff

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



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-02-04 Thread Marcin Bachry

Marcin Bachry  added the comment:

I had odd problems matching line numbers reported by Windows compiler
to actual sources, so I used "gcc -Wextra" to produce (even more)
signedness warnings against Python 2.x r77957:

  listobject.c:132: warning: comparison between signed and unsigned integer 
expressions
  listobject.c:1435: warning: comparison between signed and unsigned integer 
expressions
  listobject.c:2639: warning: comparison between signed and unsigned integer 
expressions
  listobject.c:2655: warning: comparison between signed and unsigned integer 
expressions
  listobject.c:2661: warning: comparison between signed and unsigned integer 
expressions
  listobject.c:2670: warning: comparison between signed and unsigned integer 
expressions
  bytearrayobject.c:708: warning: comparison between signed and unsigned 
integer expressions
  bytearrayobject.c:716: warning: comparison between signed and unsigned 
integer expressions
  bytearrayobject.c:920: warning: comparison between signed and unsigned 
integer expressions
  arraymodule.c:745: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:751: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:835: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:890: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:1228: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:1310: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:1326: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:1389: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:1450: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:1807: warning: comparison between signed and unsigned integer 
expressions
  arraymodule.c:1814: warning: comparison between signed and unsigned integer 
expressions

Most of them are due to comparisons between "size_t" variables and
Py_SIZE() macro which points to signed "ob_size" member of type
structure.  Because the sequence types above don't hold negative
numbers in "ob_size", I think we can silence the warnings by doing
explicit casts to "size_t".  Or we can ignore the warnings in
buildbot.  What do you think?

--

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



[issue8407] expose signalfd(2) and sigprocmask(2) in the signal module

2010-04-14 Thread Marcin Bachry

Changes by Marcin Bachry :


--
nosy: +marcin.bachry

___
Python tracker 
<http://bugs.python.org/issue8407>
___
___
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-13 Thread Marcin Bachry

Marcin Bachry  added the comment:

I wrote a Perl script testing this issue and it fails too, so it's most 
probably a bug in sqlite itself.  I think the bug is already reported under id 
26ff0c82d1 in sqlite bug tracker: http://www.sqlite.org/src/rptview?rn=2

--
nosy: +marcin.bachry

___
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



[issue4440] "sort" command doesn't work in pstats if run interactively

2008-11-26 Thread Marcin Bachry

New submission from Marcin Bachry <[EMAIL PROTECTED]>:

Sort command in Python's 3.0 pstats doesn't accept any valid argument
and views help all the time:

$ python3.0 -m pstats pstats
Welcome to the profile statistics browser.
% sort cumulative
Valid sort keys (unique prefixes are accepted):
stdname -- standard name
nfl -- name/file/line
pcalls -- call count
file -- file name
calls -- call count
time -- internal time
line -- line number
cumulative -- cumulative time
module -- file name
name -- function name
%

--
components: Library (Lib)
files: pstats-fix.diff
keywords: patch
messages: 76467
nosy: marcin.bachry
severity: normal
status: open
title: "sort" command doesn't work in pstats if run interactively
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file12137/pstats-fix.diff

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



[issue6734] Imap lib implicit conversion from bytes to string

2009-08-20 Thread Marcin Bachry

Marcin Bachry  added the comment:

It seems most IMAP4 methods accept str as arguments right now (I
checked: list, lsub, myrights, select, status, search, fetch) and
login() is a sole exception. I know the protocol is mostly ascii only,
but still having possibility of using str in the API feels convenient
and reasonable to me. Can't we convert str parameters to login() to
ascii too? It already done in other methods (the _command() method
iterates over args and converts them).

--
nosy: +marcin.bachry

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



[issue6734] Imap lib implicit conversion from bytes to string

2009-08-21 Thread Marcin Bachry

Marcin Bachry  added the comment:

Ok, it think it's good to leave internal _quote() function operating on
bytes and convert password argument in login(). The method now works
with both str and bytes as arguments.

--
keywords: +patch
Added file: http://bugs.python.org/file14752/imaplib-login.diff

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



[issue6882] uuid creates zombies

2009-09-11 Thread Marcin Bachry

Marcin Bachry  added the comment:

Actually it's a bug in ctypes.util.find_library() which is called from
uuid.py. The function doesn't close() popen object leaving forked
process in zombie state. I attach the fix.

--
keywords: +patch
nosy: +marcin.bachry
Added file: http://bugs.python.org/file14879/find_library_popen.diff

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



[issue6897] imaplib fails during login

2009-09-14 Thread Marcin Bachry

Marcin Bachry  added the comment:

Looks like duplicate of #6734.

--
nosy: +marcin.bachry

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



[issue5259] smtplib is broken in Python3

2009-04-25 Thread Marcin Bachry

Marcin Bachry  added the comment:

I add simple smtp auth unit test to exercise this bug.

--
keywords: +patch
nosy: +marcin.bachry
Added file: http://bugs.python.org/file13774/test-smtplib.diff

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



[issue4066] smtplib SMTP_SSL._get_socket doesn't return a value

2009-05-10 Thread Marcin Bachry

Marcin Bachry  added the comment:

Your diff is better than mine and looks quite similar to patch number 2
in #4470. If the whole #4470 can't be accepted for now, we could at
least apply this one change, because without it SMTP_SSL is totally
unusable. Daniel, maybe we can mark this bug or #4470 as critical?

LMTP seems ok indeed; I don't remember why I mentioned it. :)

--
nosy: +ajaksu2

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



[issue4066] smtplib SMTP_SSL._get_socket doesn't return a value

2009-05-10 Thread Marcin Bachry

Marcin Bachry  added the comment:

Here's a dumbed down version of the test from #4470. It requires
network, but no gmail account is needed to run the test.

--
Added file: http://bugs.python.org/file13952/test_smtpnet.py

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



[issue5238] ssl makefile never closes socket

2009-05-11 Thread Marcin Bachry

Marcin Bachry  added the comment:

I think there are two bugs spotted here. The first is the mentioned
missing "close" param to _fileobject in makefile() method.

The second one was noticed by Jonathan. He doesn't use makefile() at
all, yet his socket isn't closed either. Here's what I think is going on:

The raw filesystem socket seems to be closed only upon garbage
collection, when reference count of socket._realsocket drops to zero
(ie. it's not closed explicitly anywhere). _realsocket is wrapped by
socket._socketobject and all its close() method does is dropping
reference to _realsocket object it wraps.

The bug goes like this:
1. plain = socket.create_connection(...)
   it creates and wraps a native _realsocket (plain._sock) with
reference count = 1; "plain" is an instance of _socketobject
2. secure = ssl.wrap_socket(plain)
   because SSLSocket inherits from _socketobject, it also wraps
_realsocket plain._sock and the reference count is 2 now
3. secure.close()
   it calls in turn it's parent method close() which simply drops raw
_realsocket reference count to 1
4. native socket is still referenced by plain._sock and filesystem
descriptor isn't closed unless plain.close() is called too and refcount
drops to zero

I attach the simplest possible test to prove the bug.

--
nosy: +marcin.bachry
Added file: http://bugs.python.org/file13963/test-simple.py

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



[issue3541] bsddb memory leak on ubuntu

2009-05-16 Thread Marcin Bachry

Marcin Bachry  added the comment:

The test program uses constant memory on my machine. Ubuntu 9.04,
libdb4.7.25-6ubuntu1, python 2.7 trunk.

--
nosy: +marcin.bachry

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