Re: Python changes, crash in tests

2013-05-31 Fir de Conversatie James McCoy
On May 31, 2013 10:55 AM, "ZyX"  wrote:
>
> пятница, 31 мая 2013 г., 13:27:21 UTC+4 пользователь Bram Moolenaar
написал:
>
> > This is explained under :help python3.
>
> Statement "So either global symbols are loaded but only one Python
version is activated, or no global symbols are loaded." listed there has an
experimental disproof on my system. More, there is
>
> o |  Changeset 2527:8bc2e8390c11054c3bd2fc64dd17d8b2dc354f95 (branch
vim73)
> | |  Commited 10 авг. 2010 00:06 by Bram Moolenaar 
> | |  @ When building with both Python 2 and Python 3 don't use
RTLD_GLOBAL, so that
> | |  @ both may work.
>
> so you definitely did some work to make both usable at one time.

It depends on how the Python libraries are built. On Debian-based systems
(for reasons I don't recall offhand), they're built such that RTLD_GLOBAL
has to be used to get access to the symbols.  This prevents loading both
libpython2.x and libpython3.x in the same process.

The configure script has a check for whether RTLD_GLOBAL is required and
adjusts things accordingly.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-31 Fir de Conversatie ZyX
пятница, 31 мая 2013 г., 13:27:21 UTC+4 пользователь Bram Moolenaar написал:
> ZyX wrote:
> 
> 
> 
> > > > I still see a big difference between the output and what is supposed to
> 
> > > > be the output.
> 
> > > >
> 
> > > > In test86 output lines 757 to 1075 are missing.  It's like some part of
> 
> > > > the test didn't run.
> 
> > > 
> 
> > > I see the same difference in test86.
> 
> > > 
> 
> > > > In test87 there are a few errors in several lines.  E.g. getting
> 
> > > > "SyntaxError" instead of "TypeError".
> 
> > > 
> 
> > > I also see that difference in test87.
> 
> > > 
> 
> > > Furthermore, I see this kind of errors in "test87.failed" which
> 
> > > I do not see in "test87.ok":
> 
> > > 
> 
> > > E: This Vim cannot execute :python after using :py
> 
> > > E: Sorry, this command is disabled, the Python library could not be 
> > > loaded.
> 
> > > 
> 
> > > Glancing at test87.in, I see that I invokes the :py3 command
> 
> > > at line 7 for example as well as the :py command (at line 711 for
> 
> > > example).
> 
> > 
> 
> > Thanks. I am wondering though why using both pythons at a time is
> 
> > disabled in your vim, I can call both when choose both python/dyn and
> 
> > python3/dyn at a time.
> 
> 
> 
> On Linux the two dynamic libraries interfere.  When one is loaded it
> won't work to load the other one.  Vim will therefore only support the
> first one that is used.

What?! I can normally issue :py3 after :py and this will work. They do not 
interfere unless you try to use the same symbol names for both when importing 
symbols from the library. The big bunch of defines at the start of if_py*.c is 
perfectly solving this issue by using dll_ prefix for python2 and py3_ for 
python3.

> When using static libraries the build only works with either Python 2 or
> Python 3.  When trying to build with both configure will automatically
> fall back to dynamic loading.

This one I know: you import all symbols of the linked library into the only 
global namespace and python2 and python3 libraries have conflicting symbol 
names. Thus configure has no other option.

> This is explained under :help python3.

Statement "So either global symbols are loaded but only one Python version is 
activated, or no global symbols are loaded." listed there has an experimental 
disproof on my system. More, there is

o |  Changeset 2527:8bc2e8390c11054c3bd2fc64dd17d8b2dc354f95 (branch vim73)
| |  Commited 10 авг. 2010 00:06 by Bram Moolenaar 
| |  @ When building with both Python 2 and Python 3 don't use RTLD_GLOBAL, so 
that
| |  @ both may work.

so you definitely did some work to make both usable at one time.

> This patch made test 87 almost pass.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-31 Fir de Conversatie ZyX
пятница, 31 мая 2013 г., 13:27:21 UTC+4 пользователь Bram Moolenaar написал:
> ZyX wrote:
> 
> 
> 
> > пятница, 31 мая 2013 г., 0:06:49 UTC+4 пользователь Bram Moolenaar написал:
> 
> > > ZyX wrote:
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > > And this one fixes tests. And I still do not have any memory access
> 
> > > > errors, probably they were fixed by the previous posted diff. Some
> 
> > > > memory leaks are there, but nothing marked �definitely lost� in
> 
> > > > my code:
> 
> > > 
> 
> > > Memory lost in x11 functions is not our problem.
> 
> > > 
> 
> > > > Fix SystemErrors by adding RAISE_NO_EMPTY_KEYS in proper places; purge
> 
> > > > DICTKEY_* macros
> 
> > > 
> 
> > > I still see a big difference between the output and what is supposed to
> 
> > > be the output.
> 
> > > 
> 
> > > In test86 output lines 757 to 1075 are missing.  It's like some part of
> 
> > > the test didn't run.
> 
> > 
> 
> > Cannot say anything without more details. On my system tests work
> 
> > perfectly with python-2.7. Python-2.6 has some minor differences in
> 
> > output; python-2.3 has some major differences due to different repr()
> 
> > of built-in exceptions. Nothing is missing part of the test,
> 
> > especially such weird one.
> 
> 
> 
> I'll include the diff below.  I'm using Python 2.7.3, as it's on Ubuntu
> 12.10.  Lots of people must be using this.
> 
> I hope we can make the code not depend on the specific Python version as
> much as possible.  Not only for the tests, also for users who write
> scripts.  I know it's not at all easy to do this, but we can try.

It is better to disable test rather then to include this diff. I will try to 
determine what is causing the problem, but can’t you also post :messages output 
(using :redir just before :wq)?

> > > In test87 there are a few errors in several lines.  E.g. getting
> > > "SyntaxError" instead of "TypeError".
> > 
> > These are fixed with this patch:
> 
> Together with the other patch ":py" -> ":py3" only a few errors remain.
> See the diff in the attachment.

I do not see any attachments in google groups, but they are seen in gmail 
client on my phone. Wondering how is this possible.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-31 Fir de Conversatie Roland Eggner
On 2013-05-30 Thursday at 21:41 -0700 ZyX wrote:
> > Patch 7.3.1044 adds the .valid field, but there still is no
> > documentation for it.
> 
> # HG changeset patch
> # User ZyX 
> # Date 1369975224 -14400
> # Branch python-extended-4
> # Node ID b61c8091e71698a072a0106e550d05ae17e8
> # Parent  bca5a13b9afd2d9b648c8239696753f663f09147
> Add missing documentation
> 
> diff -r bca5a13b9afd -r b61c8091e716 runtime/doc/if_pyth.txt
> --- a/runtime/doc/if_pyth.txt Fri May 31 06:59:29 2013 +0400
> +++ b/runtime/doc/if_pyth.txt Fri May 31 08:40:24 2013 +0400
> @@ -176,6 +176,10 @@
>   |python-bindeval-objects|. These python objects let you modify (|List| 
>   or |Dictionary|) or call (|Funcref|) vim objecs.
>  
> +vim.strwidth(str)*python-strwidth*
> + Like |strwidth()|: returns number of display cells str occupies, tab 
> + is counted as one cell.
> +
>  Error object of the "vim" module
>  
>  vim.error*python-error*
> @@ -329,6 +333,8 @@
>   |BufFilePost| autocommands are launched.
>   b.numberBuffer number. Can be used as |python-buffers| key.
>   Read-only.
> + b.valid True or False. Buffer object becames invalid when 
.^^^

s/becames/becomes/

> + corresponding buffer is wiped out.
>  
>  The buffer object methods are:
>   b.append(str)   Append a line to the buffer
> @@ -433,6 +439,8 @@
>   row, col (read-only)On-screen window position in display cells.
>   First position is zero.
>   tabpage (read-only) Window tab page.
> + valid (read-write)  True or False. Window object becames invalid 
.^^^

> + when corresponding window is closed.
>  
>  The height attribute is writable only if the screen is split horizontally.
>  The width attribute is writable only if the screen is split vertically.
> @@ -456,6 +464,8 @@
>   windows Like |python-windows|, but for current tab page.
>   varsThe tab page |t:| variables.
>   window  Current tabpage window.
> + valid   True or False. Tab page object becames invalid when 
.  ^^^

-- 
Roland Eggner


pgp7mZX8NRJIE.pgp
Description: PGP signature


Re: Python changes, crash in tests

2013-05-31 Fir de Conversatie Bram Moolenaar

ZyX wrote:

> > Patch 7.3.1044 adds the .valid field, but there still is no
> > documentation for it.
> 
> # HG changeset patch
> # User ZyX 
> # Date 1369975224 -14400
> # Branch python-extended-4
> # Node ID b61c8091e71698a072a0106e550d05ae17e8
> # Parent  bca5a13b9afd2d9b648c8239696753f663f09147
> Add missing documentation

Thanks!

-- 
The technology involved in making anything invisible is so infinitely
complex that nine hundred and ninety-nine billion, nine hundred and
ninety-nine million, nine hundred and ninety-nine thousand, nine hundred
and ninety-nine times out of a trillion it is much simpler and more
effective just to take the thing away and do without it.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-31 Fir de Conversatie Bram Moolenaar
ZyX wrote:

> пятница, 31 мая 2013 г., 0:06:49 UTC+4 пользователь Bram Moolenaar написал:
> > ZyX wrote:
> > 
> > 
> > 
> > > And this one fixes tests. And I still do not have any memory access
> > > errors, probably they were fixed by the previous posted diff. Some
> > > memory leaks are there, but nothing marked �definitely lost� in
> > > my code:
> > 
> > Memory lost in x11 functions is not our problem.
> > 
> > > Fix SystemErrors by adding RAISE_NO_EMPTY_KEYS in proper places; purge
> > > DICTKEY_* macros
> > 
> > I still see a big difference between the output and what is supposed to
> > be the output.
> > 
> > In test86 output lines 757 to 1075 are missing.  It's like some part of
> > the test didn't run.
> 
> Cannot say anything without more details. On my system tests work
> perfectly with python-2.7. Python-2.6 has some minor differences in
> output; python-2.3 has some major differences due to different repr()
> of built-in exceptions. Nothing is missing part of the test,
> especially such weird one.

I'll include the diff below.  I'm using Python 2.7.3, as it's on Ubuntu
12.10.  Lots of people must be using this.

I hope we can make the code not depend on the specific Python version as
much as possible.  Not only for the tests, also for users who write
scripts.  I know it's not at all easy to do this, but we can try.

> > In test87 there are a few errors in several lines.  E.g. getting
> > "SyntaxError" instead of "TypeError".
> 
> These are fixed with this patch:

Together with the other patch ":py" -> ":py3" only a few errors remain.
See the diff in the attachment.


-- 
This planet has -- or rather had -- a problem, which was this: most
of the people living on it were unhappy for pretty much of the time.
Many solutions were suggested for this problem, but most of these
were largely concerned with the movements of small green pieces of
paper, which is odd because on the whole it wasn't the small green
pieces of paper that were unhappy.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




diff
Description: Binary data


Re: Python changes, crash in tests

2013-05-31 Fir de Conversatie Bram Moolenaar

ZyX wrote:

> > > I still see a big difference between the output and what is supposed to
> > > be the output.
> > >
> > > In test86 output lines 757 to 1075 are missing.  It's like some part of
> > > the test didn't run.
> > 
> > I see the same difference in test86.
> > 
> > > In test87 there are a few errors in several lines.  E.g. getting
> > > "SyntaxError" instead of "TypeError".
> > 
> > I also see that difference in test87.
> > 
> > Furthermore, I see this kind of errors in "test87.failed" which
> > I do not see in "test87.ok":
> > 
> > E: This Vim cannot execute :python after using :py
> > E: Sorry, this command is disabled, the Python library could not be loaded.
> > 
> > Glancing at test87.in, I see that I invokes the :py3 command
> > at line 7 for example as well as the :py command (at line 711 for
> > example).
> 
> Thanks. I am wondering though why using both pythons at a time is
> disabled in your vim, I can call both when choose both python/dyn and
> python3/dyn at a time.

On Linux the two dynamic libraries interfere.  When one is loaded it
won't work to load the other one.  Vim will therefore only support the
first one that is used.

When using static libraries the build only works with either Python 2 or
Python 3.  When trying to build with both configure will automatically
fall back to dynamic loading.

This is explained under :help python3.

This patch made test 87 almost pass.


-- 
Time is an illusion.  Lunchtime doubly so.
-- Ford Prefect, in Douglas Adams'
   "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie Dominique Pellé
ZyX  wrote:

>> > I still see a big difference between the output and what is supposed to
>> > be the output.
>> >
>> > In test86 output lines 757 to 1075 are missing.  It's like some part of
>> > the test didn't run.
>>
>> I see the same difference in test86.
>>
>> > In test87 there are a few errors in several lines.  E.g. getting
>> > "SyntaxError" instead of "TypeError".
>>
>> I also see that difference in test87.
>>
>> Furthermore, I see this kind of errors in "test87.failed" which
>> I do not see in "test87.ok":
>>
>> E: This Vim cannot execute :python after using :py
>> E: Sorry, this command is disabled, the Python library could not be loaded.
>>
>> Glancing at test87.in, I see that I invokes the :py3 command
>> at line 7 for example as well as the :py command (at line 711 for
>> example).
>
> Thanks. I am wondering though why using both pythons
> at a time is disabled in your vim, I can call both when
> choose both python/dyn and python3/dyn at a time.

Hi ZyX

I check further this weekend.  In the mean time
here are the Python versions used by Vim on my machine:

:py import sys
:py print(sys.version)
2.7.3 (default, Sep 26 2012, 21:53:55)
[GCC 4.7.2]

:py3 import sys
:py3 print(sys.version)
3.2.3 (default, Oct 19 2012, 19:55:38)
[GCC 4.7.2]


These are Python packages from xubuntu-12.10, I did not
compile them myself.

Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
> Patch 7.3.1044 adds the .valid field, but there still is no
> documentation for it.

# HG changeset patch
# User ZyX 
# Date 1369975224 -14400
# Branch python-extended-4
# Node ID b61c8091e71698a072a0106e550d05ae17e8
# Parent  bca5a13b9afd2d9b648c8239696753f663f09147
Add missing documentation

diff -r bca5a13b9afd -r b61c8091e716 runtime/doc/if_pyth.txt
--- a/runtime/doc/if_pyth.txt   Fri May 31 06:59:29 2013 +0400
+++ b/runtime/doc/if_pyth.txt   Fri May 31 08:40:24 2013 +0400
@@ -176,6 +176,10 @@
|python-bindeval-objects|. These python objects let you modify (|List| 
or |Dictionary|) or call (|Funcref|) vim objecs.
 
+vim.strwidth(str)  *python-strwidth*
+   Like |strwidth()|: returns number of display cells str occupies, tab 
+   is counted as one cell.
+
 Error object of the "vim" module
 
 vim.error  *python-error*
@@ -329,6 +333,8 @@
|BufFilePost| autocommands are launched.
b.numberBuffer number. Can be used as |python-buffers| key.
Read-only.
+   b.valid True or False. Buffer object becames invalid when 
+   corresponding buffer is wiped out.
 
 The buffer object methods are:
b.append(str)   Append a line to the buffer
@@ -433,6 +439,8 @@
row, col (read-only)On-screen window position in display cells.
First position is zero.
tabpage (read-only) Window tab page.
+   valid (read-write)  True or False. Window object becames invalid 
+   when corresponding window is closed.
 
 The height attribute is writable only if the screen is split horizontally.
 The width attribute is writable only if the screen is split vertically.
@@ -456,6 +464,8 @@
windows Like |python-windows|, but for current tab page.
varsThe tab page |t:| variables.
window  Current tabpage window.
+   valid   True or False. Tab page object becames invalid when 
+   corresponding tab page is closed.
 
 TabPage object type is available using "TabPage" attribute of vim module.
 

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


*** /tmp/extdiff.FsAeBu/vim.bca5a13b9afd/runtime/doc/if_pyth.txt	2013-05-31 08:41:00.399355461 +0400
--- vim.b61c8091e716/runtime/doc/if_pyth.txt	2013-05-31 08:41:00.410355355 +0400
***
*** 176,181 
--- 176,185 
  	|python-bindeval-objects|. These python objects let you modify (|List| 
  	or |Dictionary|) or call (|Funcref|) vim objecs.
  
+ vim.strwidth(str)	*python-strwidth*
+ 	Like |strwidth()|: returns number of display cells str occupies, tab 
+ 	is counted as one cell.
+ 
  Error object of the "vim" module
  
  vim.error		*python-error*
***
*** 329,334 
--- 333,340 
  			|BufFilePost| autocommands are launched.
  	b.number	Buffer number. Can be used as |python-buffers| key.
  			Read-only.
+ 	b.valid		True or False. Buffer object becames invalid when 
+ 			corresponding buffer is wiped out.
  
  The buffer object methods are:
  	b.append(str)	Append a line to the buffer
***
*** 433,438 
--- 439,446 
  	row, col (read-only)	On-screen window position in display cells.
  First position is zero.
  	tabpage (read-only)	Window tab page.
+ 	valid (read-write)	True or False. Window object becames invalid 
+ when corresponding window is closed.
  
  The height attribute is writable only if the screen is split horizontally.
  The width attribute is writable only if the screen is split vertically.
***
*** 456,461 
--- 464,471 
  	windows		Like |python-windows|, but for current tab page.
  	vars		The tab page |t:| variables.
  	window		Current tabpage window.
+ 	valid		True or False. Tab page object becames invalid when 
+ 			corresponding tab page is closed.
  
  TabPage object type is available using "TabPage" attribute of vim module.
  


Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
> What are the python versions?

And can you also post the output of :messages captured just before :wq call?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
> > I still see a big difference between the output and what is supposed to
> > be the output.
> >
> > In test86 output lines 757 to 1075 are missing.  It's like some part of
> > the test didn't run.
> 
> I see the same difference in test86.
> 
> > In test87 there are a few errors in several lines.  E.g. getting
> > "SyntaxError" instead of "TypeError".
> 
> I also see that difference in test87.
> 
> Furthermore, I see this kind of errors in "test87.failed" which
> I do not see in "test87.ok":
> 
> E: This Vim cannot execute :python after using :py
> E: Sorry, this command is disabled, the Python library could not be loaded.
> 
> Glancing at test87.in, I see that I invokes the :py3 command
> at line 7 for example as well as the :py command (at line 711 for
> example).

Thanks. I am wondering though why using both pythons at a time is disabled in 
your vim, I can call both when choose both python/dyn and python3/dyn at a time.

# HG changeset patch
# User ZyX 
# Date 1369969169 -14400
# Branch python-extended-4
# Node ID bca5a13b9afd2d9b648c8239696753f663f09147
# Parent  b1ac50f1963b2e3454eacc06339c2b4799e89557
Change :py to :py3 in test87

diff -r b1ac50f1963b -r bca5a13b9afd src/testdir/test87.in
--- a/src/testdir/test87.in Fri May 31 00:50:57 2013 +0400
+++ b/src/testdir/test87.in Fri May 31 06:59:29 2013 +0400
@@ -708,10 +708,10 @@
 :"
 :" Test stdout/stderr
 :redir => messages
-:py sys.stdout.write('abc') ; sys.stdout.write('def')
-:py sys.stderr.write('abc') ; sys.stderr.write('def')
-:py sys.stdout.writelines(iter('abc'))
-:py sys.stderr.writelines(iter('abc'))
+:py3 sys.stdout.write('abc') ; sys.stdout.write('def')
+:py3 sys.stderr.write('abc') ; sys.stderr.write('def')
+:py3 sys.stdout.writelines(iter('abc'))
+:py3 sys.stderr.writelines(iter('abc'))
 :redir END
 :$put =string(substitute(messages, '\d\+', '', 'g'))
 :" Test subclassing


> I'm using xubuntu-12.10. This is the full output of :version
> (notice that I have both "+python/dyn" and "+python3/dyn"):
> 
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May 30 2013 23:15:24)
> Flikaĵoj inkluzivitaj: 1-1077
> Kompilita de pel@pel-laptop
> Grandega versio kun grafika interfaco GTK2.  Ebloj inkluzivitaj (+) aŭ ne (-):
> +arabic  -ebcdic  +listcmds+persistent_undo +terminfo
> +autocmd +emacs_tags  +localmap+postscript
> +termresponse
> +balloon_eval+eval+lua +printer 
> +textobjects
> +browse  +ex_extra+menu+profile +title
> ++builtin_terms  +extra_search+mksession   +python/dyn  +toolbar
> +byte_offset +farsi   +modify_fname+python3/dyn
> +user_commands
> +cindent +file_in_path+mouse   +quickfix+vertsplit
> +clientserver+find_in_path+mouseshape  +reltime 
> +virtualedit
> +clipboard   +float   +mouse_dec   +rightleft   +visual
> +cmdline_compl   +folding +mouse_gpm   +ruby
> +visualextra
> +cmdline_hist-footer  -mouse_jsbterm   +scrollbind  +viminfo
> +cmdline_info+fork()  +mouse_netterm   +signs   +vreplace
> +comments+gettext +mouse_sgr   +smartindent 
> +wildignore
> +conceal -hangul_input-mouse_sysmouse  -sniff   +wildmenu
> +cryptv  +iconv   +mouse_urxvt +startuptime +windows
> +cscope  +insert_expand   +mouse_xterm +statusline  
> +writebackup
> +cursorbind  +jumplist+multi_byte  -sun_workshop+X11
> +cursorshape +keymap  +multi_lang  +syntax  -xfontset
> +dialog_con_gui  +langmap -mzscheme+tag_binary  +xim
> +diff+libcall +netbeans_intg   +tag_old_static
> +xsmp_interact
> +digraphs+linebreak   +path_extra  -tag_any_white
> +xterm_clipboard
> +dnd +lispindent  +perl+tcl 
> -xterm_save
>   sistema dosiero vimrc: "$VIM/vimrc"
> dosiero vimrc de uzanto: "$HOME/.vimrc"
>  dosiero exrc de uzanto: "$HOME/.exrc"
>  sistema dosiero gvimrc: "$VIM/gvimrc"
>dosiero gvimrc de uzanto: "$HOME/.gvimrc"
>dosiero de sistema menuo: "$VIMRUNTIME/menu.vim"
>defaŭlto de $VIM: "/usr/local/share/vim"
> Kompilado: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread
> -I/usr/include/gtk-2.0 -
> I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0
> -I/usr/include/cairo -I/usr/i
> nclude/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
> -I/usr/include/gio-unix-2.0/ -I/usr/include/glib
> -2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> -I/usr/include/pixman-1 -I/usr/include/freety
> pe2 -I/usr/include/libpng12   -I/usr/local/include  -g -O0 -Wall
> -Wextra -Wmissing-prototypes -
> Wunreachable-code -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1  -DEXITFREE
> -I/usr/include/tcl8.5  -D
> _REENTRANT=1  -D_

Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie Dominique Pellé
Bram Moolenaar wrote:

>
> ZyX wrote:
>
>> And this one fixes tests. And I still do not have any memory access
>> errors, probably they were fixed by the previous posted diff. Some
>> memory leaks are there, but nothing marked “definitely lost” in
>> my code:
>
> Memory lost in x11 functions is not our problem.
>
>> Fix SystemErrors by adding RAISE_NO_EMPTY_KEYS in proper places; purge
>> DICTKEY_* macros
>
> I still see a big difference between the output and what is supposed to
> be the output.
>
> In test86 output lines 757 to 1075 are missing.  It's like some part of
> the test didn't run.

I see the same difference in test86.

> In test87 there are a few errors in several lines.  E.g. getting
> "SyntaxError" instead of "TypeError".

I also see that difference in test87.

Furthermore, I see this kind of errors in "test87.failed" which
I do not see in "test87.ok":

E: This Vim cannot execute :python after using :py
E: Sorry, this command is disabled, the Python library could not be loaded.

Glancing at test87.in, I see that I invokes the :py3 command
at line 7 for example as well as the :py command (at line 711 for
example).

I'm using xubuntu-12.10. This is the full output of :version
(notice that I have both "+python/dyn" and "+python3/dyn"):

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May 30 2013 23:15:24)
Flikaĵoj inkluzivitaj: 1-1077
Kompilita de pel@pel-laptop
Grandega versio kun grafika interfaco GTK2.  Ebloj inkluzivitaj (+) aŭ ne (-):
+arabic  -ebcdic  +listcmds+persistent_undo +terminfo
+autocmd +emacs_tags  +localmap+postscript
+termresponse
+balloon_eval+eval+lua +printer +textobjects
+browse  +ex_extra+menu+profile +title
++builtin_terms  +extra_search+mksession   +python/dyn  +toolbar
+byte_offset +farsi   +modify_fname+python3/dyn
+user_commands
+cindent +file_in_path+mouse   +quickfix+vertsplit
+clientserver+find_in_path+mouseshape  +reltime +virtualedit
+clipboard   +float   +mouse_dec   +rightleft   +visual
+cmdline_compl   +folding +mouse_gpm   +ruby+visualextra
+cmdline_hist-footer  -mouse_jsbterm   +scrollbind  +viminfo
+cmdline_info+fork()  +mouse_netterm   +signs   +vreplace
+comments+gettext +mouse_sgr   +smartindent +wildignore
+conceal -hangul_input-mouse_sysmouse  -sniff   +wildmenu
+cryptv  +iconv   +mouse_urxvt +startuptime +windows
+cscope  +insert_expand   +mouse_xterm +statusline  +writebackup
+cursorbind  +jumplist+multi_byte  -sun_workshop+X11
+cursorshape +keymap  +multi_lang  +syntax  -xfontset
+dialog_con_gui  +langmap -mzscheme+tag_binary  +xim
+diff+libcall +netbeans_intg   +tag_old_static
+xsmp_interact
+digraphs+linebreak   +path_extra  -tag_any_white
+xterm_clipboard
+dnd +lispindent  +perl+tcl -xterm_save
  sistema dosiero vimrc: "$VIM/vimrc"
dosiero vimrc de uzanto: "$HOME/.vimrc"
 dosiero exrc de uzanto: "$HOME/.exrc"
 sistema dosiero gvimrc: "$VIM/gvimrc"
   dosiero gvimrc de uzanto: "$HOME/.gvimrc"
   dosiero de sistema menuo: "$VIMRUNTIME/menu.vim"
   defaŭlto de $VIM: "/usr/local/share/vim"
Kompilado: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread
-I/usr/include/gtk-2.0 -
I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/i
nclude/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
-I/usr/include/gio-unix-2.0/ -I/usr/include/glib
-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
-I/usr/include/pixman-1 -I/usr/include/freety
pe2 -I/usr/include/libpng12   -I/usr/local/include  -g -O0 -Wall
-Wextra -Wmissing-prototypes -
Wunreachable-code -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1  -DEXITFREE
-I/usr/include/tcl8.5  -D
_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1
Ligado: gcc-o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0
-lgio-2.0 -lpangoft2-1.0 -lpangoc
airo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig
-lgobject-2.0 -lglib-2.0
  -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl
-lselinux   -lacl -lattr -
lgpm -ldl  -L/usr/lib -llua5.1 -Wl,-E  -fstack-protector
-L/usr/local/lib  -L/usr/lib/perl/5.14
/CORE -lperl -ldl -lm -lpthread -lcrypt   -L/usr/lib -ltcl8.5 -ldl
-lpthread -lieee -lm -lruby-
1.9.1 -lpthread -lrt -ldl -lcrypt -lm  -L/usr/lib

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"v

Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
пятница, 31 мая 2013 г., 0:06:49 UTC+4 пользователь Bram Moolenaar написал:
> ZyX wrote:
> 
> 
> 
> > And this one fixes tests. And I still do not have any memory access
> > errors, probably they were fixed by the previous posted diff. Some
> > memory leaks are there, but nothing marked �definitely lost� in
> > my code:
> 
> Memory lost in x11 functions is not our problem.
> 
> > Fix SystemErrors by adding RAISE_NO_EMPTY_KEYS in proper places; purge
> > DICTKEY_* macros
> 
> I still see a big difference between the output and what is supposed to
> be the output.
> 
> In test86 output lines 757 to 1075 are missing.  It's like some part of
> the test didn't run.

Cannot say anything without more details. On my system tests work perfectly 
with python-2.7. Python-2.6 has some minor differences in output; python-2.3 
has some major differences due to different repr() of built-in exceptions. 
Nothing is missing part of the test, especially such weird one.

> In test87 there are a few errors in several lines.  E.g. getting
> "SyntaxError" instead of "TypeError".

These are fixed with this patch:

# HG changeset patch
# User ZyX 
# Date 1369947057 -14400
# Branch python-extended-4
# Node ID b1ac50f1963b2e3454eacc06339c2b4799e89557
# Parent  91666dd3057c5ffc5c212316163eaedfe1e4943a
Fix syntax errors with = (3, 3) and e.__class__ is AttributeError 
and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."):
+cb.append(expr + ':' + repr((e.__class__, 
AttributeError(str(e)[str(e).rfind(" '") + 2:-1]
+else:
+cb.append(expr + ':' + repr((e.__class__, e)))
 else:
 cb.append(expr + ':NOT FAILED')
 except Exception as e:
@@ -784,8 +787,8 @@
 def stringtochars_test(expr):
 return subexpr_test(expr, 'StringToChars', (
 '1',   # Fail type checks
-'u"\\0"',  # Fail PyString_AsStringAndSize(bytes, , NULL) check
-'"\\0"',   # Fail PyString_AsStringAndSize(object, , NULL) check
+'b"\\0"',  # Fail PyString_AsStringAndSize(object, , NULL) check
+'"\\0"',   # Fail PyString_AsStringAndSize(bytes, , NULL) check
 ))
 
 class Mapping(object):
diff -r 91666dd3057c -r b1ac50f1963b src/testdir/test87.ok
--- a/src/testdir/test87.ok Thu May 30 23:39:02 2013 +0400
+++ b/src/testdir/test87.ok Fri May 31 00:50:57 2013 +0400
@@ -454,7 +454,7 @@
 d.get("a", 2, 3):(, TypeError('function takes at most 2 
arguments (3 given)',))
 >>> Testing StringToChars using d.get(%s)
 d.get(1):(, TypeError('object must be string',))
-d.get(u"\0"):(, TypeError('expected bytes with no null',))
+d.get(b"\0"):(, TypeError('expected bytes with no null',))
 d.get("\0"):(, TypeError('expected bytes with no null',))
 <<< Finished
 d.pop("a"):(, KeyError('a',))
@@ -465,22 +465,22 @@
 dl["b"] = 1:(, error('dict is locked',))
 >>> Testing StringToChars using d[%s] = 1
 d[1] = 1:(, TypeError('object must be string',))
-d[u"\0"] = 1:(, TypeError('expected bytes with no null',))
+d[b"\0"] = 1:(, TypeError('expected bytes with no null',))
 d["\0"] = 1:(, TypeError('expected bytes with no null',))
 <<< Finished
 >>> Testing StringToChars using d["a"] = {%s : 1}
 d["a"] = {1 : 1}:(, TypeError('object must be string',))
-d["a"] = {u"\0" : 1}:(, TypeError('expected bytes with no 
null',))
+d["a"] = {b"\0" : 1}:(, TypeError('expected bytes with no 
null',))
 d["a"] = {"\0" : 1}:(, TypeError('expected bytes with no 
null',))
 <<< Finished
 >>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}}
 d["a"] = {"abc" : {1 : 1}}:(, TypeError('object must be 
string',))
-d["a"] = {"abc" : {u"\0" : 1}}:(, TypeError('expected bytes 
with no null',))
+d["a"] = {"abc" : {b"\0" : 1}}:(, TypeError('expected bytes 
with no null',))
 d["a"] = {"abc" : {"\0" : 1}}:(, TypeError('expected bytes 
with no null',))
 <<< Finished
 >>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})}
 d["a"] = {"abc" : Mapping({1 : 1})}:(, TypeError('object 
must be string',))
-d["a"] = {"abc" : Mapping({u"\0" : 1})}:(, 
TypeError('expected bytes with no null',))
+d["a"] = {"abc" : Mapping({b"\0" : 1})}:(, 
TypeError('expected bytes with no null',))
 d["a"] = {"abc" : Mapping({"\0" : 1})}:(, 
TypeError('expected bytes with no null',))
 <<< Finished
 >>> Testing *Iter* using d["a"] = {"abc" : %s}
@@ -496,17 +496,17 @@
 <<< Finished
 >>> Testing StringToChars using d["a"] = Mapping({%s : 1})
 d["a"] = Mapping({1 : 1}):(, TypeError('object must be 
string',))
-d["a"] = Mapping({u"\0" : 1}):(, TypeError('expected bytes 
with no null',))
+d["a"] = Mapping({b"\0" : 1}):(, TypeError('expected bytes 
with no null',))
 d["a"] = Mapping({"\0" : 1}):(, TypeError('expected bytes 
with no null',))
 <<< Finished
 >>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}})
 d["a"] = Mapping({"abc" : {1 : 1}}):(, TypeError('object 
must be string',))
-d["a"] = Mapping({"abc" : {u"\0" : 1}}):(, 
TypeError('expected bytes with no null',))
+d["a"] = Mapping({"abc

Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie Bram Moolenaar

ZyX wrote:

> And this one fixes tests. And I still do not have any memory access
> errors, probably they were fixed by the previous posted diff. Some
> memory leaks are there, but nothing marked “definitely lost” in
> my code:

Memory lost in x11 functions is not our problem.

> Fix SystemErrors by adding RAISE_NO_EMPTY_KEYS in proper places; purge
> DICTKEY_* macros

I still see a big difference between the output and what is supposed to
be the output.

In test86 output lines 757 to 1075 are missing.  It's like some part of
the test didn't run.

In test87 there are a few errors in several lines.  E.g. getting
"SyntaxError" instead of "TypeError".

I'll keep the tests disabled until this is solved.


-- 
`The Guide says there is an art to flying,' said Ford, `or at least a
knack. The knack lies in learning how to throw yourself at the ground
and miss.' He smiled weakly.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
# HG changeset patch
# User ZyX 
# Date 1369942742 -14400
# Branch python-extended-4
# Node ID 91666dd3057c5ffc5c212316163eaedfe1e4943a
# Parent  969d365e3905ef96abdda7ba4fb43fd5bf45ae36
Fix some possible memory problems

diff -r 969d365e3905 -r 91666dd3057c src/if_py_both.h
--- a/src/if_py_both.h  Thu May 30 23:00:46 2013 +0400
+++ b/src/if_py_both.h  Thu May 30 23:39:02 2013 +0400
@@ -1174,6 +1174,7 @@
 if (*key == NUL)
 {
RAISE_NO_EMPTY_KEYS;
+   Py_XDECREF(todecref);
return -1;
 }
 
@@ -1192,11 +1193,15 @@
hi = hash_find(&dict->dv_hashtab, di->di_key);
hash_remove(&dict->dv_hashtab, hi);
dictitem_free(di);
+   Py_XDECREF(todecref);
return 0;
 }
 
 if (ConvertFromPyObject(valObject, &tv) == -1)
+{
+   Py_XDECREF(todecref);
return -1;
+}
 
 if (di == NULL)
 {
@@ -2416,11 +2421,8 @@
PyObject*todecref;
 
if ((val = StringToChars(valObject, &todecref)))
-   {
r = set_option_value_for(key, 0, val, opt_flags,
self->opt_type, self->from);
-   Py_XDECREF(todecref);
-   }
else
r = -1;
 }
diff -r 969d365e3905 -r 91666dd3057c src/testdir/test86.in
--- a/src/testdir/test86.in Thu May 30 23:00:46 2013 +0400
+++ b/src/testdir/test86.in Thu May 30 23:39:02 2013 +0400
@@ -851,6 +851,7 @@
 return subexpr_test(expr, 'ConvertFromPyObject', (
 'None', # Not conversible
 '{"": 1}',  # Empty key not allowed
+'{u"": 1}', # Same, but with unicode object
 'FailingMapping()', #
 'FailingMappingKey()',  #
 ))
diff -r 969d365e3905 -r 91666dd3057c src/testdir/test86.ok
--- a/src/testdir/test86.ok Thu May 30 23:00:46 2013 +0400
+++ b/src/testdir/test86.ok Thu May 30 23:39:02 2013 +0400
@@ -501,6 +501,7 @@
 >>> Testing ConvertFromPyObject using d["a"] = {"abc" : %s}
 d["a"] = {"abc" : None}:(, TypeError('unable to 
convert to vim structure',))
 d["a"] = {"abc" : {"": 1}}:(, ValueError('empty 
keys are not allowed',))
+d["a"] = {"abc" : {u"": 1}}:(, ValueError('empty 
keys are not allowed',))
 d["a"] = {"abc" : FailingMapping()}:(, 
NotImplementedError())
 d["a"] = {"abc" : FailingMappingKey()}:(, NotImplementedError())
 <<< Finished
@@ -526,6 +527,7 @@
 >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abc" : %s})
 d["a"] = Mapping({"abc" : None}):(, 
TypeError('unable to convert to vim structure',))
 d["a"] = Mapping({"abc" : {"": 1}}):(, 
ValueError('empty keys are not allowed',))
+d["a"] = Mapping({"abc" : {u"": 1}}):(, 
ValueError('empty keys are not allowed',))
 d["a"] = Mapping({"abc" : FailingMapping()}):(, NotImplementedError())
 d["a"] = Mapping({"abc" : FailingMappingKey()}):(, NotImplementedError())
 <<< Finished
@@ -536,6 +538,7 @@
 >>> Testing ConvertFromPyObject using d["a"] = %s
 d["a"] = None:(, TypeError('unable to convert to 
vim structure',))
 d["a"] = {"": 1}:(, ValueError('empty keys are 
not allowed',))
+d["a"] = {u"": 1}:(, ValueError('empty keys are 
not allowed',))
 d["a"] = FailingMapping():(, 
NotImplementedError())
 d["a"] = FailingMappingKey():(, 
NotImplementedError())
 <<< Finished
@@ -570,6 +573,7 @@
 >>> Testing ConvertFromPyObject using d.update({"abc" : %s})
 d.update({"abc" : None}):(, TypeError('unable to 
convert to vim structure',))
 d.update({"abc" : {"": 1}}):(, ValueError('empty 
keys are not allowed',))
+d.update({"abc" : {u"": 1}}):(, 
ValueError('empty keys are not allowed',))
 d.update({"abc" : FailingMapping()}):(, 
NotImplementedError())
 d.update({"abc" : FailingMappingKey()}):(, NotImplementedError())
 <<< Finished
@@ -595,6 +599,7 @@
 >>> Testing ConvertFromPyObject using d.update(Mapping({"abc" : %s}))
 d.update(Mapping({"abc" : None})):(, 
TypeError('unable to convert to vim structure',))
 d.update(Mapping({"abc" : {"": 1}})):(, 
ValueError('empty keys are not allowed',))
+d.update(Mapping({"abc" : {u"": 1}})):(, 
ValueError('empty keys are not allowed',))
 d.update(Mapping({"abc" : FailingMapping()})):(, NotImplementedError())
 d.update(Mapping({"abc" : FailingMappingKey()})):(, NotImplementedError())
 <<< Finished
@@ -605,6 +610,7 @@
 >>> Testing ConvertFromPyObject using d.update(%s)
 d.update(None):(, TypeError("'NoneType' object is 
not iterable",))
 d.update({"": 1}):(, ValueError('empty keys are 
not allowed',))
+d.update({u"": 1}):(, ValueError('empty keys are 
not allowed',))
 d.update(FailingMapping()):(, 
NotImplementedError())
 d.update(FailingMappingKey()):(, 
NotImplementedError())
 <<< Finished
@@ -635,6 +641,7 @@
 >>> Testing ConvertFromPyObject using d.update((("a", {"abc" : %s}),))
 d.update((("a", {"abc" : None}),)):(, 
TypeError('unable to convert to vim structure',))
 d.update((("a", {"abc" : {"": 1}}),)):(, 
ValueError('empty keys are not allowed',))
+d.update((("a", {"abc" : {u"": 1}}),)):(, 
ValueError('empty keys are not allowed',))

Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
четверг, 30 мая 2013 г., 23:07:37 UTC+4 пользователь ZyX написал:
> And this one fixes tests. And I still do not have any memory access errors, 
> probably they were fixed by the previous posted diff. Some memory leaks are 
> there, but nothing marked "definitely lost" in my code:

There is a big bunch of "possibly lost" leaks though. I am not sure whether 
they are worth bothering. Most of such leaks have nothing to do with my code.

Also there are additional definitely lost leaks with test87.in, but they all 
look like

==10905==at 0x4C2C88D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10905==by 0x7A27139: strdup (in /lib64/libc-2.15.so)
==10905==by 0x14A36E72: ???
==10905==by 0x14A3732F: ???
==10905==by 0x689345: Python_Init (if_python.c:866)

(the number of question marks vary, strdup is present only in one of the 
additional reports, but Python_Init and malloc are always there before and 
after the question marks). Python3 additionally has two "invalid read of size 
8" errors:

==10905== Invalid read of size 8
==10905==at 0x7A3F9E7: wcschr (in /lib64/libc-2.15.so)
==10905==by 0x126F1A71: makepathobject (sysmodule.c:1738)
==10905==by 0x126F1BDA: PySys_SetPath (sysmodule.c:1766)
==10905==by 0x126DF3D4: _Py_InitializeEx_Private (pythonrun.c:342)
==10905==by 0x126DF63C: Py_InitializeEx (pythonrun.c:401)
==10905==by 0x126DF64C: Py_Initialize (pythonrun.c:407)
==10905==by 0x69AE52: Python3_Init (if_python3.c:810)
==10905==by 0x69740F: DoPyCommand (if_python3.c:883)
==10905==by 0x6973D1: ex_py3 (if_python3.c:946)
==10905==by 0x4B57FC: do_one_cmd (ex_docmd.c:2686)
==10905==by 0x4B19D2: do_cmdline (ex_docmd.c:1124)
==10905==by 0x568B66: nv_colon (normal.c:5457)
==10905==by 0x55E27A: normal_cmd (normal.c:1200)
==10905==by 0x6BC1B0: main_loop (main.c:1329)
==10905==by 0x6B8434: main (main.c:1020)
==10905==  Address 0x1122f218 is 776 bytes inside a block of size 780 alloc'd
==10905==at 0x4C2C88D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10905==by 0x125C4FA6: PyMem_Malloc (object.c:1840)
==10905==by 0x12706B0E: calculate_path (getpath.c:732)
==10905==by 0x12706F93: Py_GetProgramFullPath (getpath.c:871)
==10905==by 0x126F0D78: _PySys_Init (sysmodule.c:1615)
==10905==by 0x126DF344: _Py_InitializeEx_Private (pythonrun.c:334)
==10905==by 0x126DF63C: Py_InitializeEx (pythonrun.c:401)
==10905==by 0x126DF64C: Py_Initialize (pythonrun.c:407)
==10905==by 0x69AE52: Python3_Init (if_python3.c:810)
==10905==by 0x69740F: DoPyCommand (if_python3.c:883)
==10905==by 0x6973D1: ex_py3 (if_python3.c:946)
==10905==by 0x4B57FC: do_one_cmd (ex_docmd.c:2686)
==10905==by 0x4B19D2: do_cmdline (ex_docmd.c:1124)
==10905==by 0x568B66: nv_colon (normal.c:5457)
==10905==by 0x55E27A: normal_cmd (normal.c:1200)
==10905==by 0x6BC1B0: main_loop (main.c:1329)
==10905==by 0x6B8434: main (main.c:1020)
==10905== 
==10905== Invalid read of size 8
==10905==at 0x7A3F9E7: wcschr (in /lib64/libc-2.15.so)
==10905==by 0x126F1AB6: makepathobject (sysmodule.c:1746)
==10905==by 0x126F1BDA: PySys_SetPath (sysmodule.c:1766)
==10905==by 0x126DF3D4: _Py_InitializeEx_Private (pythonrun.c:342)
==10905==by 0x126DF63C: Py_InitializeEx (pythonrun.c:401)
==10905==by 0x126DF64C: Py_Initialize (pythonrun.c:407)
==10905==by 0x69AE52: Python3_Init (if_python3.c:810)
==10905==by 0x69740F: DoPyCommand (if_python3.c:883)
==10905==by 0x6973D1: ex_py3 (if_python3.c:946)
==10905==by 0x4B57FC: do_one_cmd (ex_docmd.c:2686)
==10905==by 0x4B19D2: do_cmdline (ex_docmd.c:1124)
==10905==by 0x568B66: nv_colon (normal.c:5457)
==10905==by 0x55E27A: normal_cmd (normal.c:1200)
==10905==by 0x6BC1B0: main_loop (main.c:1329)
==10905==by 0x6B8434: main (main.c:1020)
==10905==  Address 0x1122f218 is 776 bytes inside a block of size 780 alloc'd
==10905==at 0x4C2C88D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10905==by 0x125C4FA6: PyMem_Malloc (object.c:1840)
==10905==by 0x12706B0E: calculate_path (getpath.c:732)
==10905==by 0x12706F93: Py_GetProgramFullPath (getpath.c:871)
==10905==by 0x126F0D78: _PySys_Init (sysmodule.c:1615)
==10905==by 0x126DF344: _Py_InitializeEx_Private (pythonrun.c:334)
==10905==by 0x126DF63C: Py_InitializeEx (pythonrun.c:401)
==10905==by 0x126DF64C: Py_Initialize (pythonrun.c:407)
==10905==by 0x69AE52: Python3_Init (if_python3.c:810)
==10905==by 0x69740F: DoPyCommand (if_python3.c:883)
==10905==by 0x6973D1: ex_py3 (if_python3.c:946)
==10905==by 0x4B57FC: do_one_cmd (ex_docmd.c:2686)
==10905==by 0x4B19D2: do_cmdline (ex_docmd.c:1124)
==10905==by 0x568B66: nv_colon (normal.c:5457)
==10905==by 0x55E27A: normal_cmd (normal.c:1200)
==10905==by 0x6BC1B0: main_loop (main.c:1329)
==10905==by 0x6B8434: main (main.c:1020)

-- 
-- 
You 

Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
And this one fixes tests. And I still do not have any memory access errors, 
probably they were fixed by the previous posted diff. Some memory leaks are 
there, but nothing marked “definitely lost” in my code:

==8730== 33 bytes in 1 blocks are definitely lost in loss record 272 of 2,807
==8730==at 0x4C2C88D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8730==by 0xC3B0C2C: ??? (in /usr/lib64/opengl/nvidia/lib/libGL.so.313.30)
==8730==by 0x797A2F656D6F682E: ???
==8730==by 0x72502F612E612F77: ???
==8730==by 0x6D69762F632F6A6E: ???
==8730==by 0x6D69762F6372732E: ???
==8730== 
==8730== 47 bytes in 1 blocks are definitely lost in loss record 348 of 2,807
==8730==at 0x4C2C88D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8730==by 0x67DE5DA: XStringListToTextProperty (in 
/usr/lib64/libX11.so.6.3.0)
==8730==by 0x596564: set_x11_title (os_unix.c:1982)
==8730==by 0x595FD3: mch_settitle (os_unix.c:2121)
==8730==by 0x5967A3: mch_restore_title (os_unix.c:2171)
==8730==by 0x5977F1: mch_exit (os_unix.c:3158)
==8730==by 0x6BB720: getout (main.c:1504)
==8730==by 0x4BE8C9: ex_exit (ex_docmd.c:6974)
==8730==by 0x4B57FC: do_one_cmd (ex_docmd.c:2686)
==8730==by 0x4B19D2: do_cmdline (ex_docmd.c:1124)
==8730==by 0x568B66: nv_colon (normal.c:5457)
==8730==by 0x55E27A: normal_cmd (normal.c:1200)
==8730==by 0x6BC1B0: main_loop (main.c:1329)
==8730==by 0x6B8434: main (main.c:1020)
==8730== 
==8730== 49 bytes in 1 blocks are definitely lost in loss record 360 of 2,807
==8730==at 0x4C2C88D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8730==by 0x67DE5DA: XStringListToTextProperty (in 
/usr/lib64/libX11.so.6.3.0)
==8730==by 0x596564: set_x11_title (os_unix.c:1982)
==8730==by 0x595FD3: mch_settitle (os_unix.c:2121)
==8730==by 0x443288: resettitle (buffer.c:3464)
==8730==by 0x43DCAE: maketitle (buffer.c:3432)
==8730==by 0x6BBEFE: main_loop (main.c:1240)
==8730==by 0x6B8434: main (main.c:1020)

…

==8730== 292 (52 direct, 240 indirect) bytes in 1 blocks are definitely lost in 
loss record 1,964 of 2,807
==8730==at 0x4C2C88D: malloc (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8730==by 0x7A9D63A: nss_parse_service_list (in /lib64/libc-2.15.so)
==8730==by 0x7A9DB1D: __nss_database_lookup (in /lib64/libc-2.15.so)
==8730==by 0x108B155F: ???
==8730==by 0x108B3014: ???
==8730==by 0x7A5A79C: getpwuid_r@@GLIBC_2.2.5 (in /lib64/libc-2.15.so)
==8730==by 0x7A5A036: getpwuid (in /lib64/libc-2.15.so)
==8730==by 0x596C99: mch_get_uname (os_unix.c:2304)
==8730==by 0x596C71: mch_get_user_name (os_unix.c:2287)
==8730==by 0x54E3DC: get_user_name (misc2.c:6012)
==8730==by 0x5162D4: set_b0_fname (memline.c:963)
==8730==by 0x515EF0: ml_open (memline.c:352)
==8730==by 0x439344: open_buffer (buffer.c:98)
==8730==by 0x6BAE7B: create_windows (main.c:2670)
==8730==by 0x6B7FCC: main (main.c:855)

# HG changeset patch
# User ZyX 
# Date 1369940446 -14400
# Branch python-extended-4
# Node ID 969d365e3905ef96abdda7ba4fb43fd5bf45ae36
# Parent  b16cc3931caec2373abc5eac9396f88aac318e80
Fix SystemErrors by adding RAISE_NO_EMPTY_KEYS in proper places; purge 
DICTKEY_* macros

diff -r b16cc3931cae -r 969d365e3905 src/if_py_both.h
--- a/src/if_py_both.h  Thu May 30 22:33:32 2013 +0400
+++ b/src/if_py_both.h  Thu May 30 23:00:46 2013 +0400
@@ -26,31 +26,13 @@
 
 #define PyErr_SetVim(str) PyErr_SetString(VimError, str)
 
+#define RAISE_NO_EMPTY_KEYS PyErr_SetString(PyExc_ValueError, \
+   _("empty keys are not allowed"))
+
 #define INVALID_BUFFER_VALUE ((buf_T *)(-1))
 #define INVALID_WINDOW_VALUE ((win_T *)(-1))
 #define INVALID_TABPAGE_VALUE ((tabpage_T *)(-1))
 
-#define DICTKEY_DECL \
-PyObject   *dictkey_todecref = NULL;
-#define DICTKEY_GET(err, decref) \
-if (!(key = StringToChars(keyObject, &dictkey_todecref))) \
-{ \
-   if (decref) \
-   { \
-   Py_DECREF(keyObject); \
-   } \
-   return err; \
-} \
-if (decref && !dictkey_todecref) \
-   dictkey_todecref = keyObject; \
-if (*key == NUL) \
-{ \
-   PyErr_SetString(PyExc_ValueError, _("empty keys are not allowed")); \
-   return err; \
-}
-#define DICTKEY_UNREF \
-Py_XDECREF(dictkey_todecref);
-
 typedef void (*rangeinitializer)(void *);
 typedef void (*runner)(const char *, void *
 #ifdef PY_CAN_RECURSE
@@ -1016,8 +998,7 @@
 dictitem_T *di;
 dict_T *dict = self->dict;
 hashitem_T *hi;
-
-DICTKEY_DECL
+PyObject   *todecref;
 
 if (flags & DICT_FLAG_HAS_DEFAULT)
 {
@@ -1030,11 +1011,18 @@
 if (flags & DICT_FLAG_RETURN_BOOL)
defObject = Py_False;
 
-DICTKEY_GET(NULL, 0)
+if (!(key = StringToChars(keyObject, &todecref)))
+   return NULL;
+
+if (*key == NUL)
+{
+   RAISE_NO_EMPTY_KEYS

Re: Python changes, crash in tests

2013-05-30 Fir de Conversatie ZyX
четверг, 30 мая 2013 г., 17:39:19 UTC+4 пользователь Bram Moolenaar написал:
> I have included all the Python patches that ZyX sent.

This hunks are present in the python-extended-3-fixed branch, but missing in 
your patches:

# HG changeset patch
# User ZyX 
# Date 1369938812 -14400
# Branch python-extended-4
# Node ID b16cc3931caec2373abc5eac9396f88aac318e80
# Parent  1a4b98208569a60fab5662e02077aa3d3b62193b
Missing changes

diff -r 1a4b98208569 -r b16cc3931cae src/if_py_both.h
--- a/src/if_py_both.h  Thu May 30 19:18:31 2013 +0200
+++ b/src/if_py_both.h  Thu May 30 22:33:32 2013 +0400
@@ -4528,7 +4528,7 @@
 PyObject   *valObject;
 Py_ssize_t iter = 0;
 
-if (!(dict = dict_alloc()))
+if (!(dict = py_dict_alloc()))
return -1;
 
 tv->v_type = VAR_DICT;
@@ -4600,7 +4600,7 @@
 PyObject   *keyObject;
 PyObject   *valObject;
 
-if (!(dict = dict_alloc()))
+if (!(dict = py_dict_alloc()))
return -1;
 
 tv->v_type = VAR_DICT;

It is essential as py_dict_alloc increments reference count for dictionaries 
that are then decremented and thus cause the crash. Even with this patch tests 
for errors are still failing though, but there are no crashes.

> Unfortunately the current status is that Vim crashes while running tests
> 86 and 87.  I'm sending out a patch to disable these tests so that I can
> continue with other work.
> 
> Obviously the crash should be fixed ASAP.  I tried syncing back to a
> previous version, and it appears to crash first with 7.3.1056.
> But I'm not sure, valgrind reports errors much further back, so there
> might be crashes even before that, depending on random factors.
> 
> ZyX - I hope you can fix the crashes, and possibly all valgrind errors.
> Memory leak problems can be solved later, but we definitely don't want
> memory access errors.
> 
> Patch 7.3.1044 adds the .valid field, but there still is no
> documentation for it.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.