this repo has no description
1/* Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) */
2#pragma once
3
4#include "cpython-data.h"
5
6#include "globals.h"
7#include "handles.h"
8#include "modules.h"
9#include "runtime.h"
10#include "symbols.h"
11#include "thread.h"
12#include "view.h"
13
14namespace py {
15
16// Get a function pointer out of the current frame's consts.
17inline void* getNativeFunc(Thread* thread) {
18 HandleScope scope(thread);
19 Code code(&scope, thread->currentFrame()->code());
20 Tuple consts(&scope, code.consts());
21 DCHECK(consts.length() == 1, "Unexpected tuple length");
22 Int raw_fn(&scope, consts.at(0));
23 return raw_fn.asCPtr();
24}
25
26RawObject newExtCode(Thread* thread, const Object& name,
27 View<SymbolId> parameters, word flags,
28 BuiltinFunction function, void* slot_value);
29
30RawObject newGetSet(Thread* thread, const Object& name, PyGetSetDef* def);
31
32} // namespace py