@@ -2681,15 +2681,30 @@ index 4aa7e6559a..511d77024c 100644
2681
2681
sin(pi*x), giving accurate results for all finite x (especially x
2682
2682
integral or close to an integer). This is here for use in the
2683
2683
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
2684
- index 12f72f525f..a2355bf93f 100644
2684
+ index 12f72f525f..ec487c6d0e 100644
2685
2685
--- a/Modules/posixmodule.c
2686
2686
+++ b/Modules/posixmodule.c
2687
- @@ -56,6 +56,28 @@
2687
+ @@ -56,6 +56,8 @@
2688
2688
*/
2689
2689
#if defined(__APPLE__)
2690
2690
2691
2691
+ #include "TargetConditionals.h"
2692
2692
+
2693
+ #if defined(__has_builtin) && __has_builtin(__builtin_available)
2694
+ # define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
2695
+ # define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
2696
+ @@ -169,7 +171,6 @@
2697
+ disguised Unix interface). Refer to the library manual and\n\
2698
+ corresponding Unix manual entries for more information on calls.");
2699
+
2700
+ -
2701
+ #ifdef HAVE_SYS_UIO_H
2702
+ # include <sys/uio.h>
2703
+ #endif
2704
+ @@ -326,6 +327,26 @@
2705
+ # endif /* _MSC_VER */
2706
+ #endif /* ! __WATCOMC__ || __QNX__ */
2707
+
2693
2708
+ // iOS/tvOS/watchOS *define* a number of POSIX functions, but you can't use them
2694
2709
+ // because iOS isn't a conventional multiprocess environment.
2695
2710
+ #if TARGET_OS_IPHONE
@@ -2710,18 +2725,65 @@ index 12f72f525f..a2355bf93f 100644
2710
2725
+ # undef HAVE_WAITPID
2711
2726
+ #endif
2712
2727
+
2713
- #if defined(__has_builtin) && __has_builtin(__builtin_available)
2714
- # define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
2715
- # define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
2716
- @@ -169,7 +191,6 @@
2717
- disguised Unix interface). Refer to the library manual and\n\
2718
- corresponding Unix manual entries for more information on calls.");
2728
+ _Py_IDENTIFIER(__fspath__);
2719
2729
2720
- -
2721
- #ifdef HAVE_SYS_UIO_H
2722
- # include <sys/uio.h>
2723
- #endif
2724
- @@ -1509,7 +1530,9 @@
2730
+ /*[clinic input]
2731
+ @@ -549,27 +570,33 @@
2732
+ }
2733
+ }
2734
+ }
2735
+ + #endif
2736
+
2737
+ void
2738
+ PyOS_BeforeFork(void)
2739
+ {
2740
+ + #ifdef HAVE_FORK
2741
+ run_at_forkers(_PyInterpreterState_GET()->before_forkers, 1);
2742
+
2743
+ _PyImport_AcquireLock();
2744
+ + #endif
2745
+ }
2746
+
2747
+ void
2748
+ PyOS_AfterFork_Parent(void)
2749
+ {
2750
+ + #ifdef HAVE_FORK
2751
+ if (_PyImport_ReleaseLock() <= 0)
2752
+ Py_FatalError("failed releasing import lock after fork");
2753
+
2754
+ run_at_forkers(_PyInterpreterState_GET()->after_forkers_parent, 0);
2755
+ + #endif
2756
+ }
2757
+
2758
+ void
2759
+ PyOS_AfterFork_Child(void)
2760
+ {
2761
+ + #ifdef HAVE_FORK
2762
+ _PyRuntimeState *runtime = &_PyRuntime;
2763
+ _PyGILState_Reinit(runtime);
2764
+ _PyEval_ReInitThreads(runtime);
2765
+ @@ -579,8 +606,10 @@
2766
+ _PyInterpreterState_DeleteExceptMain(runtime);
2767
+
2768
+ run_at_forkers(_PyInterpreterState_GET()->after_forkers_child, 0);
2769
+ + #endif
2770
+ }
2771
+
2772
+ + #ifdef HAVE_FORK
2773
+ static int
2774
+ register_at_forker(PyObject **lst, PyObject *func)
2775
+ {
2776
+ @@ -600,9 +629,7 @@
2777
+ void
2778
+ PyOS_AfterFork(void)
2779
+ {
2780
+ - #ifdef HAVE_FORK
2781
+ PyOS_AfterFork_Child();
2782
+ - #endif
2783
+ }
2784
+
2785
+
2786
+ @@ -1509,7 +1536,9 @@
2725
2787
*/
2726
2788
#include <crt_externs.h>
2727
2789
#elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__))
@@ -2731,23 +2793,23 @@ index 12f72f525f..a2355bf93f 100644
2731
2793
#endif /* !_MSC_VER */
2732
2794
2733
2795
static PyObject *
2734
- @@ -1525,6 +1548 ,7 @@
2796
+ @@ -1525,6 +1554 ,7 @@
2735
2797
d = PyDict_New();
2736
2798
if (d == NULL)
2737
2799
return NULL;
2738
2800
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
2739
2801
#ifdef MS_WINDOWS
2740
2802
/* _wenviron must be initialized in this way if the program is started
2741
2803
through main() instead of wmain(). */
2742
- @@ -1580,6 +1604 ,7 @@
2804
+ @@ -1580,6 +1610 ,7 @@
2743
2805
Py_DECREF(k);
2744
2806
Py_DECREF(v);
2745
2807
}
2746
2808
+ #endif
2747
2809
return d;
2748
2810
}
2749
2811
2750
- @@ -4739,7 +4764 ,12 @@
2812
+ @@ -4739,7 +4770 ,12 @@
2751
2813
}
2752
2814
2753
2815
Py_BEGIN_ALLOW_THREADS
@@ -2760,15 +2822,15 @@ index 12f72f525f..a2355bf93f 100644
2760
2822
Py_END_ALLOW_THREADS
2761
2823
return result;
2762
2824
}
2763
- @@ -13332,6 +13362 ,7 @@
2825
+ @@ -13332,6 +13368 ,7 @@
2764
2826
int is_symlink;
2765
2827
int need_stat;
2766
2828
#endif
2767
2829
+ #if !TARGET_OS_TV && !TARGET_OS_WATCH
2768
2830
#ifdef MS_WINDOWS
2769
2831
unsigned long dir_bits;
2770
2832
#endif
2771
- @@ -13392,6 +13423 ,7 @@
2833
+ @@ -13392,6 +13429 ,7 @@
2772
2834
#endif
2773
2835
2774
2836
return result;
0 commit comments