[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-27 Thread Steve Dower

Steve Dower added the comment:

That's true, though if you use the embeddable distribution of Python 3.5 you 
automatically get the equivalent behavior because of a new option (the 
"applocal" option in pyvenv.cfg, which is enabled in that distro by default).

--

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-27 Thread David Heffernan

David Heffernan added the comment:

Thanks for following up Steve, and thanks for changing resolution to dupe. 

As for 3.5 and embedding the docs are much the same as 2.7 in that the example 
code at https://docs.python.org/3/extending/embedding.html doesn't explicitly 
set Python home. 

Anyway, I'm very happy with how this report has been dealt with. Thank you all.

--

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-22 Thread Eryk Sun

Changes by Eryk Sun :


--
stage:  -> resolved

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-22 Thread Eryk Sun

Changes by Eryk Sun :


--
resolution: not a bug -> duplicate
superseder:  -> 32-bit 2.7.11 installer creates registry keys that are 
incompatible with the installed python27.dll

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-21 Thread David Heffernan

David Heffernan added the comment:

Why was this closed as "not a bug"? Shouldn't it have been closed as a 
duplicate?

--

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-16 Thread Steve Dower

Changes by Steve Dower :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-14 Thread David Heffernan

David Heffernan added the comment:

Thanks Eryk, everything you described happens exactly as you describe it. Much 
appreciated.

As it happens, I'm not distributing Python because I want to give my users the 
flexibility to use whatever version they please, and with whatever third party 
modules they want. So I'll just advise them to avoid 2.7.11.

--

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-14 Thread David Heffernan

David Heffernan added the comment:

Note that I've just listed the Windows versions on which I have tested this. I 
have not tested on Windows 7 or Vista so do not know whether or not the issue 
exists there.

--

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-14 Thread David Heffernan

New submission from David Heffernan:

Environment: 
 - Python 2.7.11 from python.org, x64.
 - Windows 10 or Windows 8.1
 - MSVC 2015

I compiled the most basic embedding example, taken from the Python docs:

#include 

int
main(int argc, char *argv[])
{
  Py_SetProgramName(argv[0]);  /* optional but recommended */
  Py_Initialize();
  PyRun_SimpleString("from time import time,ctime\n"
 "print 'Today is',ctime(time())\n");
  Py_Finalize();
  return 0;
}

When run the call to Py_Initialize does not return and the process is 
terminated.

--
components: Windows
messages: 258194
nosy: David Heffernan, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Calling PyInitialize with 2.7.11 on Windows x64 terminates process
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-14 Thread Eryk Sun

Eryk Sun added the comment:

Probably this is related to issue 25824. When built as a console application 
and run from the command prompt, you should see an the error

ImportError: No module named site

If that's the case, the problem is that even the 64-bit build is incorrectly 
setting the DLL version string to "2.7-32":

0:000> da poi(python27!PyWin_DLLVersionString)
`50b878c0  "2.7-32"

So the interpreter is looking at the wrong registry key to get the default 
sys.path:

python27!getpythonregpath+0x110:
`509a3d90 ff15b2d20500callqword ptr
[python27!_imp_RegOpenKeyExA (`50a01048)]
ds:`50a01048=
{ADVAPI32!RegOpenKeyExAStub (7ffb`56f87d70)}
0:000> da @rdx
0037`e4fd9940  "Software\Python\PythonCore\2.7-3"
0037`e4fd9960  "2\PythonPath"

As a workaround, before calling Py_Initialize, add 
Py_SetPythonHome("C:\\Python27"), or wherever you installed Python. Or create a 
symbolic link to Python's Lib directory in the directory that has your 
executable:

mklink /d Lib "C:\Python27\Lib"

Or 'fix' the "SOFTWARE\Python\PythonCore\2.7" registry key by renaming it to 
"2.7-32". Or downgrade to 2.7.10 until 2.7.12 is released. 

That said, probably you'll use a zipped library if distributing an application, 
in which case this shouldn't be a problem.

--
nosy: +eryksun

___
Python tracker 

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