Skip to content

Commit 1f0ff44

Browse files
committed
Snapshot linux state
1 parent 9cdf696 commit 1f0ff44

5 files changed

Lines changed: 37 additions & 3 deletions

File tree

Lib/multiprocessing/spawn.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,20 @@ def get_command_line(**kwds):
9292
prog %= ', '.join('%s=%r' % item for item in kwds.items())
9393
opts = util._args_from_interpreter_flags()
9494
exe = get_executable()
95-
return [exe] + opts + ['-c', prog, '--multiprocessing-fork']
95+
# CCP addition, to get multiprocessing to work for exefile interpreter.
96+
# We determine this by checking if `blue` can be imported (it is not built for a non-CCP python interpreter)
97+
# Exefile interpreter needs the /py argument in order to run regular python scripts
98+
# Additionally we need our environment setup correctly with the @args which we inherit from the parent proc
99+
try:
100+
import blue
101+
except ImportError:
102+
return [exe] + opts + ['-c', prog, '--multiprocessing-fork']
103+
else:
104+
blueargs = blue.os.GetStartupArgs()
105+
if not blue.os.HasStartupArg('py'):
106+
raise ImportError('Can only import multiprocessing when running in python interpreter mode')
107+
blueargs = blueargs[:blueargs.index('/py') + 1]
108+
return blueargs + opts + ['-c', prog, '--multiprocessing-fork']
96109

97110

98111
def spawn_main(pipe_handle, parent_pid=None, tracker_fd=None):

Lib/sysconfig.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,20 @@ def _init_posix(vars):
533533
"""Initialize the module as appropriate for POSIX systems."""
534534
# _sysconfigdata is generated at build time, see _generate_posix_vars()
535535
name = _get_sysconfigdata_name()
536-
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
536+
try:
537+
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
538+
except ImportError:
539+
# CCP Python Customization
540+
#
541+
# The sysconfig module provides information about the Python build configuration.
542+
# This gets done by importing a Python file that gets generated at buildtime.
543+
# This generated Python file contains one variable called build_time_vars, which is a dict,
544+
# and provides a bunch of build specific information which we don't really need,
545+
# and might change frequently between builds, so we don't want to publish it to Perforce.
546+
# However, we have some nonessential code that calls `sysconfig.get_config_vars()` and expects a result.
547+
# Since without the generated Python file this call results in an `ImportError`,
548+
# we make the function that loads these variables into a no-op.
549+
return
537550
build_time_vars = _temp.build_time_vars
538551
vars.update(build_time_vars)
539552

Lib/test/test_asyncio/test_sock_lowlevel.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import asyncio
33
import sys
44
import unittest
5+
import os
56

67
from asyncio import proactor_events
78
from itertools import cycle, islice
@@ -556,6 +557,12 @@ def create_event_loop(self):
556557
return asyncio.SelectorEventLoop()
557558

558559

560+
@unittest.skipIf(
561+
os.getenv("TEAMCITY_VERSION"),
562+
"Tests assume WSARecvFrom will always report ERROR_PORT_UNREACHABLE when the socket "
563+
"used for the receive was previously used to send to an address that is not listening. "
564+
"This is not the case on our build agents, so the first receive after sending to an address "
565+
"that wasn't listening would hang forever.")
559566
class ProactorEventLoopTests(BaseSockTestsMixin,
560567
test_utils.TestCase):
561568

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ libpython3.so: libpython$(LDVERSION).so
826826
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
827827

828828
libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
829-
$(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
829+
$(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,@executable_path/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
830830

831831

832832
libpython$(VERSION).sl: $(LIBRARY_OBJS)

PCbuild/build.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ echo on
173173
/p:IncludeCTypes=%IncludeCTypes%^
174174
/p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^
175175
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
176+
/p:PlatformToolset=v141 /p:WindowsTargetPlatformVersion=10.0.17763.0^
176177
%1 %2 %3 %4 %5 %6 %7 %8 %9
177178

178179
@echo off

0 commit comments

Comments
 (0)