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
2990640d
Kaydet (Commit)
2990640d
authored
Ara 10, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add a comment explaining the st_symbols cache.
üst
5801a2d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
symtable.c
Python/symtable.c
+15
-1
No files found.
Python/symtable.c
Dosyayı görüntüle @
2990640d
...
...
@@ -4,6 +4,20 @@
#include "graminit.h"
#include "structmember.h"
/* The compiler uses this function to load a PySymtableEntry object
for a code block. Each block is loaded twice, once during the
symbol table pass and once during the code gen pass. Entries
created during the first pass are cached for the second pass, using
the st_symbols dictionary.
The cache is keyed by st_nscopes. Each code block node in a
module's parse tree can be assigned a unique id based on the order
in which the nodes are visited by the compiler. This strategy
works so long as the symbol table and codegen passes visit the same
nodes in the same order.
*/
PyObject
*
PySymtableEntry_New
(
struct
symtable
*
st
,
char
*
name
,
int
type
,
int
lineno
)
{
...
...
@@ -14,7 +28,7 @@ PySymtableEntry_New(struct symtable *st, char *name, int type, int lineno)
if
(
k
==
NULL
)
goto
fail
;
v
=
PyDict_GetItem
(
st
->
st_symbols
,
k
);
if
(
v
)
/* XXX could check that name, type, lineno match */
{
if
(
v
)
{
Py_DECREF
(
k
);
Py_INCREF
(
v
);
return
v
;
...
...
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