Skip to content

Instantly share code, notes, and snippets.

View mattip's full-sized avatar

Matti Picus mattip

  • Quansight Labs
View GitHub Profile
@mattip
mattip / gist:1cb3c04fe1c285f62dfb4884cc1c5f22
Last active March 10, 2024 08:48
Build aarch64, ppc pypy feedstock
Build aarch64, ppc pypy feedstock
for each machine aarch64 (for instance gcc185.fsffrance.org), 140.211.169.173 (ppc64le)
1a. Mambaforge is preferred.
1b. screen
2a. conda create -n build python=3.11
2b. conda activate build
2c. conda install -y git conda-build conda-smithy anaconda-client boa patch
3a. git clone https://github.com/conda-forge/pypy3.6-feedstock.git
3b. cd pypy3.6-feedstock
@mattip
mattip / From git and from Mercurial
Last active January 11, 2024 18:12
Contributors, via running pypy/doc/tools/makecontributors.py
I used `paste` and `column` to align the datasets
From Git From Mercurial
19929 Armin Rigo 26748 Armin Rigo
7835 Maciej Fijałkowski 11696 Maciej Fijałkowski
7346 Matti Picus 9704 Matti Picus
6930 Carl Friedrich Bolz-Tereick 9224 Carl Friedrich Bolz-Tereick
4511 Antonio Cuni 5604 Antonio Cuni
4037 Amaury Forgeot d'Arc 4905 Amaury Forgeot d'Arc
3679 Ronan Lamy 4379 Ronan Lamy
@mattip
mattip / info.md
Last active December 28, 2023 16:09
Converting hg repo to git, with notes for each node which branch it came from

Cloning the hg repo as a git repo

the tools

Get this repo https://github.com/mnauw/git-remote-hg which is a fork of the original and supports modern git/hg. Copy git-hg-helper and git-remote-hg to ~/bin and make them executable with chmod +x ~/bin/git*

clone the repo as both hg and git

git clone hg::https://foss.heptapod.net/pypy/cffi cffi-git

@mattip
mattip / gist:71e0d0f0c212a04afd955d470f63dbc2
Last active December 3, 2023 18:35
stack just before recursion error
Running `python -c "import numpy", I get a recursion error. Running a lldebug0 build under gdb, here is the backtrace.
Searching for cpyext, I see there is a chain starting around frame 75 that maybe I can do something about.
But why are there 40 recursive calls to `pypy_g_dispatch_bytecode__AccessDirect_None` ?
#0 __pyx_pf_5numpy_6random_13bit_generator_12SeedSequence_4generate_state (__pyx_v_self=0xcfb1c0, __pyx_v_n_words=0xcfd7b0, __pyx_v_dtype=0x95de18)
at numpy/random/bit_generator.c:6289
#1 0x00007fffec5c0cc5 in __pyx_pw_5numpy_6random_13bit_generator_12SeedSequence_5generate_state (__pyx_v_self=0xcfb1c0, __pyx_args=0xcfd960,
__pyx_kwds=0xcfd9b0) at numpy/random/bit_generator.c:6114
#2 0x00007ffff2b4446f in pypy_g_cpy_call_external__funcPtr__objectPtr__objectPtr_1 (
@mattip
mattip / gist:7df3e9f37b8b3bdc6faab0b44594ac4e
Created January 16, 2023 08:19
lib-python failures py3.10 Jan 16
$ grep '^[A-Za-z]*Error' /tmp/stdout.txt |sort |uniq -c |sort -n -r
65 AssertionError: DeprecationWarning not triggered
48 AssertionError: TypeError not raised by dumps
42 AssertionError: events did not match expectation:
16 AssertionError: Lists differ: [1, 1] != [2, 2]
13 ValueError: array.index(x): x not in list
13 AssertionError: UnicodeEncodeError not raised
8 AssertionError: TypeError not raised
7 SyntaxError: invalid syntax
6 AssertionError: 4294967298 != 0
@mattip
mattip / gist:e7834c9c93b38d05f177a4d4e334a829
Created July 17, 2021 19:39
C/Assembler of the call to PyUFunc_GenericFunctionInternal
This C function
typedef struct {
PyObject *in;
PyObject *out;
} ufunc_full_args;
static int
PyUFunc_GenericFunctionInternal(PyUFuncObject *ufunc, PyArrayObject **op,
ufunc_full_args full_args, PyObject *type_tup, PyObject *extobj,
@mattip
mattip / test.py
Last active May 18, 2021 05:57
Comparison of jit summary before and after py3.7-cpyext-unroll-a-bit 1f4c96de61ee
BEFORE AFTER
[4e2f663bd9fe8] {jit-summary [4e2d5889878b8] {jit-summary
Tracing: 86 0.100334 Tracing: 78 0.113238
Backend: 74 0.031218 Backend: 66 0.032329
TOTAL: 1.515222 TOTAL: 1.509000
ops: 124400 ops: 123038
heapcached ops: 78660 heapcached ops: 79768
recorded ops: 39196 recorded ops: 40168
calls: 6160 calls: 5844
guards: 9656 guards: 10059
@mattip
mattip / gist:aca31b74e5373fc6f7273950aa735949
Last active February 7, 2021 07:33
benchmark for str.replace
import random
import pyperf
def create_data(fname='/tmp/lines.txt'):
printable = tuple(c for c in (chr(i) for i in range(32, 0x110000)) if c.isprintable() and not c.isspace())
with open(fname, "w", encoding="utf8") as f:
for _ in range(10000):
f.write("".join(random.choices(printable, k=random.randint(1000, 10000))))
f.write("\n")
diff --git a/cpp/src/arrow/python/datetime.cc b/cpp/src/arrow/python/datetime.cc
index 4eeab7f5a..9a7624ef7 100644
--- a/cpp/src/arrow/python/datetime.cc
+++ b/cpp/src/arrow/python/datetime.cc
@@ -74,6 +74,7 @@ bool MatchFixedOffset(const std::string& tz, util::string_view* sign,
} // namespace
+#ifndef PYPY_VERSION
PyDateTime_CAPI* datetime_api = nullptr;
@mattip
mattip / gist:75f97b4cbf639d892af47be49c468fe9
Last active August 28, 2020 14:49
searching affiliate websites
diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js
index 970d0d975..90fd3a0f6 100644
--- a/sphinx/themes/basic/static/searchtools.js
+++ b/sphinx/themes/basic/static/searchtools.js
@@ -107,6 +107,13 @@ var Search = {
this._queued_query = query;
},
+ setAffiliate : function(index) {
+ if (this._affiliates == null) {