diff options
author | Georg Brandl <georg@python.org> | 2012-02-20 21:31:46 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2012-02-20 21:31:46 +0100 |
commit | c046a714e1f2152c7f45bc90d6f3829c34e7029f (patch) | |
tree | 4ad97aaf7ffcf9e49750a59179ef736b8e62e6e1 /Include/frameobject.h | |
parent | 5af1ccb2a86c32b4a7ed302bd75dd824606fc222 (diff) | |
parent | 9edd5e108cf2736595d6bb117e1a2a45b4403e85 (diff) | |
download | cpython-c046a714e1f2152c7f45bc90d6f3829c34e7029f.tar.gz |
Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
Diffstat (limited to 'Include/frameobject.h')
-rw-r--r-- | Include/frameobject.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Include/frameobject.h b/Include/frameobject.h index 65ebd2ad52..1fb64bb268 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -1,6 +1,7 @@ /* Frame object interface */ +#ifndef Py_LIMITED_API #ifndef Py_FRAMEOBJECT_H #define Py_FRAMEOBJECT_H #ifdef __cplusplus @@ -38,8 +39,11 @@ typedef struct _frame { PyThreadState *f_tstate; int f_lasti; /* Last instruction if called */ - /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when - f_trace is set) -- at other times use PyCode_Addr2Line instead. */ + /* Call PyFrame_GetLineNumber() instead of reading this field + directly. As of 2.3 f_lineno is only valid when tracing is + active (i.e. when f_trace is set). At other times we use + PyCode_Addr2Line to calculate the line from the current + bytecode index. */ int f_lineno; /* Current line number */ int f_iblock; /* index in f_blockstack */ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ @@ -75,7 +79,11 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); PyAPI_FUNC(int) PyFrame_ClearFreeList(void); +/* Return the line of code the frame is currently executing. */ +PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); + #ifdef __cplusplus } #endif #endif /* !Py_FRAMEOBJECT_H */ +#endif /* Py_LIMITED_API */ |