Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
dae0276b
Kaydet (Commit)
dae0276b
authored
Eyl 14, 2017
tarafından
Eric Snow
Kaydeden (comit)
GitHub
Eyl 14, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-30860: Fix a refleak. (#3567)
Resolves bpo-31420. (This was accidentally reverted when in #3565.)
üst
93c92f7d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
43 deletions
+47
-43
object.h
Include/object.h
+1
-2
pystate.h
Include/pystate.h
+0
-2
object.c
Objects/object.c
+15
-12
pylifecycle.c
Python/pylifecycle.c
+9
-1
pystate.c
Python/pystate.c
+0
-2
pythonrun.c
Python/pythonrun.c
+4
-1
sysmodule.c
Python/sysmodule.c
+18
-23
No files found.
Include/object.h
Dosyayı görüntüle @
dae0276b
...
...
@@ -727,14 +727,13 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
/* Py_REF_DEBUG also controls the display of refcounts and memory block
* allocations at the interactive prompt and at interpreter shutdown
*/
PyAPI_FUNC
(
PyObject
*
)
_PyDebug_XOptionShowRefCount
(
void
);
PyAPI_FUNC
(
void
)
_PyDebug_PrintTotalRefs
(
void
);
#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs()
#else
#define _Py_INC_REFTOTAL
#define _Py_DEC_REFTOTAL
#define _Py_REF_DEBUG_COMMA
#define _Py_CHECK_REFCNT(OP)
/* a semicolon */
;
#define _PY_DEBUG_PRINT_TOTAL_REFS()
#endif
/* Py_REF_DEBUG */
#ifdef COUNT_ALLOCS
...
...
Include/pystate.h
Dosyayı görüntüle @
dae0276b
...
...
@@ -61,8 +61,6 @@ typedef struct _is {
/* Used in Python/sysmodule.c. */
int
check_interval
;
PyObject
*
warnoptions
;
PyObject
*
xoptions
;
/* Used in Modules/_threadmodule.c. */
long
num_threads
;
...
...
Objects/object.c
Dosyayı görüntüle @
dae0276b
...
...
@@ -29,20 +29,23 @@ _Py_GetRefTotal(void)
return
total
;
}
void
_PyDebug_PrintTotalRefs
(
void
)
{
PyObject
*
xoptions
,
*
value
;
PyObject
*
_PyDebug_XOptionShowRefCount
(
void
)
{
PyObject
*
xoptions
=
PySys_GetXOptions
();
if
(
xoptions
==
NULL
)
return
NULL
;
_Py_IDENTIFIER
(
showrefcount
);
return
_PyDict_GetItemId
(
xoptions
,
&
PyId_showrefcount
);
}
xoptions
=
PySys_GetXOptions
();
if
(
xoptions
==
NULL
)
return
;
value
=
_PyDict_GetItemId
(
xoptions
,
&
PyId_showrefcount
);
if
(
value
==
Py_True
)
fprintf
(
stderr
,
"[%"
PY_FORMAT_SIZE_T
"d refs, "
"%"
PY_FORMAT_SIZE_T
"d blocks]
\n
"
,
_Py_GetRefTotal
(),
_Py_GetAllocatedBlocks
());
void
_PyDebug_PrintTotalRefs
(
void
)
{
fprintf
(
stderr
,
"[%"
PY_FORMAT_SIZE_T
"d refs, "
"%"
PY_FORMAT_SIZE_T
"d blocks]
\n
"
,
_Py_GetRefTotal
(),
_Py_GetAllocatedBlocks
());
}
#endif
/* Py_REF_DEBUG */
...
...
Python/pylifecycle.c
Dosyayı görüntüle @
dae0276b
...
...
@@ -1011,6 +1011,11 @@ Py_FinalizeEx(void)
while
(
_PyGC_CollectIfEnabled
()
>
0
)
/* nothing */
;
#endif
#ifdef Py_REF_DEBUG
PyObject
*
showrefcount
=
_PyDebug_XOptionShowRefCount
();
#endif
/* Destroy all modules */
PyImport_Cleanup
();
...
...
@@ -1058,7 +1063,10 @@ Py_FinalizeEx(void)
/* dump hash stats */
_PyHash_Fini
();
_PY_DEBUG_PRINT_TOTAL_REFS
();
#ifdef Py_REF_DEBUG
if
(
showrefcount
==
Py_True
)
_PyDebug_PrintTotalRefs
();
#endif
#ifdef Py_TRACE_REFS
/* Display all objects still alive -- this can invoke arbitrary
...
...
Python/pystate.c
Dosyayı görüntüle @
dae0276b
...
...
@@ -97,8 +97,6 @@ PyInterpreterState_New(void)
interp
->
builtins_copy
=
NULL
;
interp
->
tstate_head
=
NULL
;
interp
->
check_interval
=
100
;
interp
->
warnoptions
=
NULL
;
interp
->
xoptions
=
NULL
;
interp
->
num_threads
=
0
;
interp
->
pythread_stacksize
=
0
;
interp
->
codec_search_path
=
NULL
;
...
...
Python/pythonrun.c
Dosyayı görüntüle @
dae0276b
...
...
@@ -113,7 +113,10 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags *
err
=
-
1
;
for
(;;)
{
ret
=
PyRun_InteractiveOneObject
(
fp
,
filename
,
flags
);
_PY_DEBUG_PRINT_TOTAL_REFS
();
#ifdef Py_REF_DEBUG
if
(
_PyDebug_XOptionShowRefCount
()
==
Py_True
)
_PyDebug_PrintTotalRefs
();
#endif
if
(
ret
==
E_EOF
)
{
err
=
0
;
break
;
...
...
Python/sysmodule.c
Dosyayı görüntüle @
dae0276b
...
...
@@ -36,12 +36,14 @@ extern const char *PyWin_DLLVersionString;
_Py_IDENTIFIER
(
_
);
_Py_IDENTIFIER
(
__sizeof__
);
_Py_IDENTIFIER
(
_xoptions
);
_Py_IDENTIFIER
(
buffer
);
_Py_IDENTIFIER
(
builtins
);
_Py_IDENTIFIER
(
encoding
);
_Py_IDENTIFIER
(
path
);
_Py_IDENTIFIER
(
stdout
);
_Py_IDENTIFIER
(
stderr
);
_Py_IDENTIFIER
(
warnoptions
);
_Py_IDENTIFIER
(
write
);
PyObject
*
...
...
@@ -1481,13 +1483,17 @@ list_builtin_module_names(void)
static
PyObject
*
get_warnoptions
(
void
)
{
PyObject
*
warnoptions
=
PyThreadState_GET
()
->
interp
->
warnoptions
;
PyObject
*
warnoptions
=
_PySys_GetObjectId
(
&
PyId_warnoptions
)
;
if
(
warnoptions
==
NULL
||
!
PyList_Check
(
warnoptions
))
{
Py_XDECREF
(
warnoptions
);
warnoptions
=
PyList_New
(
0
);
if
(
warnoptions
==
NULL
)
return
NULL
;
PyThreadState_GET
()
->
interp
->
warnoptions
=
warnoptions
;
if
(
_PySys_SetObjectId
(
&
PyId_warnoptions
,
warnoptions
))
{
Py_DECREF
(
warnoptions
);
return
NULL
;
}
Py_DECREF
(
warnoptions
);
}
return
warnoptions
;
}
...
...
@@ -1495,7 +1501,7 @@ get_warnoptions(void)
void
PySys_ResetWarnOptions
(
void
)
{
PyObject
*
warnoptions
=
PyThreadState_GET
()
->
interp
->
warnoptions
;
PyObject
*
warnoptions
=
_PySys_GetObjectId
(
&
PyId_warnoptions
)
;
if
(
warnoptions
==
NULL
||
!
PyList_Check
(
warnoptions
))
return
;
PyList_SetSlice
(
warnoptions
,
0
,
PyList_GET_SIZE
(
warnoptions
),
NULL
);
...
...
@@ -1524,20 +1530,24 @@ PySys_AddWarnOption(const wchar_t *s)
int
PySys_HasWarnOptions
(
void
)
{
PyObject
*
warnoptions
=
PyThreadState_GET
()
->
interp
->
warnoptions
;
PyObject
*
warnoptions
=
_PySys_GetObjectId
(
&
PyId_warnoptions
)
;
return
(
warnoptions
!=
NULL
&&
(
PyList_Size
(
warnoptions
)
>
0
))
?
1
:
0
;
}
static
PyObject
*
get_xoptions
(
void
)
{
PyObject
*
xoptions
=
PyThreadState_GET
()
->
interp
->
xoptions
;
PyObject
*
xoptions
=
_PySys_GetObjectId
(
&
PyId__xoptions
)
;
if
(
xoptions
==
NULL
||
!
PyDict_Check
(
xoptions
))
{
Py_XDECREF
(
xoptions
);
xoptions
=
PyDict_New
();
if
(
xoptions
==
NULL
)
return
NULL
;
PyThreadState_GET
()
->
interp
->
xoptions
=
xoptions
;
if
(
_PySys_SetObjectId
(
&
PyId__xoptions
,
xoptions
))
{
Py_DECREF
(
xoptions
);
return
NULL
;
}
Py_DECREF
(
xoptions
);
}
return
xoptions
;
}
...
...
@@ -2086,16 +2096,6 @@ _PySys_BeginInit(void)
#undef SET_SYS_FROM_STRING_BORROW
/* Updating the sys namespace, returning integer error codes */
#define SET_SYS_FROM_STRING_BORROW_INT_RESULT(key, value) \
do { \
PyObject *v = (value); \
if (v == NULL) \
return -1; \
res = PyDict_SetItemString(sysdict, key, v); \
if (res < 0) { \
return res; \
} \
} while (0)
#define SET_SYS_FROM_STRING_INT_RESULT(key, value) \
do { \
PyObject *v = (value); \
...
...
@@ -2140,15 +2140,11 @@ _PySys_EndInit(PyObject *sysdict)
SET_SYS_FROM_STRING_INT_RESULT
(
"base_exec_prefix"
,
PyUnicode_FromWideChar
(
Py_GetExecPrefix
(),
-
1
));
PyObject
*
warnoptions
=
get_warnoptions
();
if
(
warnoptions
==
NULL
)
if
(
get_warnoptions
()
==
NULL
)
return
-
1
;
SET_SYS_FROM_STRING_BORROW_INT_RESULT
(
"warnoptions"
,
warnoptions
);
PyObject
*
xoptions
=
get_xoptions
();
if
(
xoptions
==
NULL
)
if
(
get_xoptions
()
==
NULL
)
return
-
1
;
SET_SYS_FROM_STRING_BORROW_INT_RESULT
(
"_xoptions"
,
xoptions
);
if
(
PyErr_Occurred
())
return
-
1
;
...
...
@@ -2156,7 +2152,6 @@ _PySys_EndInit(PyObject *sysdict)
}
#undef SET_SYS_FROM_STRING_INT_RESULT
#undef SET_SYS_FROM_STRING_BORROW_INT_RESULT
static
PyObject
*
makepathobject
(
const
wchar_t
*
path
,
wchar_t
delim
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment