From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Sho Takemori Newsgroups: gmane.emacs.bugs Subject: bug#24117: 25.1; url-http-create-request: Multibyte text in HTTP request Date: Mon, 1 Aug 2016 08:21:39 +0900 Message-ID: References: <83d1ltq3p6.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c0481aef25b020538f6be7f X-Trace: blaine.gmane.org 1470007361 8075 80.91.229.8 (31 Jul 2016 23:22:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 31 Jul 2016 23:22:41 +0000 (UTC) Cc: 24117@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 01 01:22:24 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bU03r-00023H-N0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Aug 2016 01:22:24 +0200 Original-Received: from localhost ([::1]:41123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bU03n-0000Y2-Qh for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Jul 2016 19:22:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bU03c-0000Xw-5P for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2016 19:22:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bU03W-0008Fh-0D for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2016 19:22:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bU03V-0008Fc-Rt for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2016 19:22:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bU03V-0006TR-L0 for bug-gnu-emacs@gnu.org; Sun, 31 Jul 2016 19:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sho Takemori Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jul 2016 23:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24117 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24117-submit@debbugs.gnu.org id=B24117.147000731124868 (code B ref 24117); Sun, 31 Jul 2016 23:22:01 +0000 Original-Received: (at 24117) by debbugs.gnu.org; 31 Jul 2016 23:21:51 +0000 Original-Received: from localhost ([127.0.0.1]:52416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bU03J-0006T0-PZ for submit@debbugs.gnu.org; Sun, 31 Jul 2016 19:21:51 -0400 Original-Received: from mail-oi0-f54.google.com ([209.85.218.54]:34709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bU03G-0006Sl-7T for 24117@debbugs.gnu.org; Sun, 31 Jul 2016 19:21:47 -0400 Original-Received: by mail-oi0-f54.google.com with SMTP id l65so171742115oib.1 for <24117@debbugs.gnu.org>; Sun, 31 Jul 2016 16:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=D9pogyrhVeawbnOAPOuQZpiP3rCU4kK9VRUZXGCAKbA=; b=seEIZzeeWYShR+4Bn9Wh4zWTZCT/x0QafISzN+o3g+LNDxakfynbIZ0VZsQguQNtIo +quXpBHVvInJf3OA3fK8hu4c+OyMixqZvVMJGVBgTkzN50wJ9ZGY2mXXjr95Ym3MhdhP CC0aiBVXTIOghgW2EDeaELndWRdBPJBMiGQzFMicScq1ZVXMrFXROfpSefOQIJkl204Q 5cIqxt9KIR55gqhYNo59Ga+ijVq4QpWYyy8Sqc6YB4I+uGkjXhNZ4ZQ5aoPr0qSsB2ux cXyfXMtnBNc9cV8TSjeXdC245z+I4GuBsRUehiDCPAOIlFCpSvQqOzO9+sMMp/x2Tlbz V/Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=D9pogyrhVeawbnOAPOuQZpiP3rCU4kK9VRUZXGCAKbA=; b=dbCrsXS54Sdq8j41HqOSZ2wDriL8IemSu6XFvzxw4XZa/4VkQEXlTmGCzq9Y1S5kL3 XEGrSchyIth0aiLNHV7IAYi2ghJ1CgduocAMS+R/JO9oijAVv1WvbdmltMiACYnOH01x S+Wj1MLPFoO49ud+5cEAhT1AVFcviT+o54ZeU5dmDagx5FMgL2PIRqENjYpt4Bd9XNwL ajo9eaLOmyGXGkrwvfCV3MSxtSWJhLFX+CBUj77djh2w2sSItisWpvQ/mxYsOJdfQdTh W1Bfx+Fl5CBhbZiNQJamRYGjdSQz8e7nce89kYKkUO7O0yooKqWmhddt1JN8lalNqjSx b+mg== X-Gm-Message-State: AEkoouuMey0lDTmBYY24whLnBgreZIKKW/f4w5lvlBJ0PVOizPBaNf3WvfFTZ+k3CbINFGHbVLmg9oykEfrPZA== X-Received: by 10.157.9.6 with SMTP id 6mr33487197otp.132.1470007300215; Sun, 31 Jul 2016 16:21:40 -0700 (PDT) Original-Received: by 10.157.33.77 with HTTP; Sun, 31 Jul 2016 16:21:39 -0700 (PDT) In-Reply-To: <83d1ltq3p6.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121750 Archived-At: --94eb2c0481aef25b020538f6be7f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable It seems that anaconda-mode use two global variables (url-request-method and url-request-data) to make generate the request. https://github.com/proofit404/anaconda-mode/blob/master/anaconda-mode.el#L3= 49 url-request-method is bound to an ASCII string "POST". In my situation, url-request-data is bound to a unibyte string as below. "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eldoc\",\"params\":{\"source\":= \"# -*- coding: utf-8 -*-\\nimport itertools\\nfrom itertools import groupby\\n\\nfrom sage.all import mul\\nfrom sage.arith.all import kronecker_symbol\\nfrom sage.functions.all import ceil, floor, sgn\\nfrom sage.matrix.all import (block_diagonal_matrix, block_matrix,\\n diagonal_matrix, identity_matrix, matrix)\\nfrom sage.misc.all import cached_function\\nfrom sage.quadratic_forms.all import QuadraticForm, least_quadratic_nonresidue\\nfrom sage.rings.all import QQ, ZZ, CyclotomicField, FiniteField, PolynomialRing\\n\\n\\ndef _index_of_gamma_0_gl_n(alpha, p):\\n '''\\n Returns delta(a1, ..., an) defined in Shimura, Euler products and Eisenstein\\n series, pp 118, (15.1.7).\\n '''\\n if p in ZZ:\\n p =3D ZZ(p)\\n\\n def _bn(n):\\n return mul(1 - p ** (-i) for i in xrange(1, n + 1))\\n\\n e_r_ls =3D [(k, len(list(v)))\\n for k, v in groupby(sorted(alpha), lambda x: x)]\\n res =3D _bn(len(alpha)) / mul(_bn(r) for _, r in e_r_ls)\\n for i, (ei, ri) in enumerate(e_r_ls):\\n for j, (ej, rj) in enumerate(e_r_ls):\\n if i < j:\\n res *=3D p ** ((ej - ei) * ri * rj)\\n return res\\n\\n\\ndef _gl2_coset_gamma0(a, p):\\n w =3D matrix([[0, -1],\\n [1, 0]])\\n for m12 in range(p ** a):\\n yield matrix([[1, m12],\\n [0, 1]])\\n for m21 in range(p ** (a - 1)):\\n m =3D matrix([[1, 0],\\n = [p * m21, 1]])\\n yield w * m\\n\\n\\ndef _gl3_coset_gamma0(alpha, p):\\n r'''\\n Let alpha =3D [a0, a1, a2] with a0 <=3D a1 <=3D a2,\\n= g =3D diag([p^a0, p^a1, p^a2]), and Gamma0 =3D g^(-1) GL3(Z) g \342\210\247 GL3(Z).\\n Return a complete set Gamma0 \\\\ GL3(Z).\\n '''\\n if p in ZZ:\\n p =3D ZZ(p)\\n a0, a1, a2 =3D alpha\\n if a0 < a1 = < a2:\\n return list(__gl3_coset_gamma0_distinct(a0, a1, a2, p))\\n elif a0 =3D=3D a1 and a1 < a2:\\n return list(__gl3_coset_gamma0_2_1(a0, a2, p))\\n elif a0 < a1 and a1 =3D=3D a2= :\\n return list(__gl3_coset_gamma0_1_2(a0, a2, p))\\n elif a0 =3D=3D = a1 =3D=3D a2:\\n return [identity_matrix(ZZ, 3)]\\n else:\\n raise ValueError\\n\\n\\ndef __gl3_coset_gamma0_2_1(a1, a3, p):\\n w23 =3D matrix([[1, 0, 0],\\n [0, 0, 1],\\n [= 0, 1, 0]])\\n for m13 in range(p ** (a3 - a1 - 1)):\\n for m23 in range(p ** (a3 - a1 - 1)):\\n m =3D matrix([[1, 0, p * m13],\\n [0, 1, p * m23],\\n [0, 0, 1]])\\n yield m\\n\\n for m32 in range(p ** (a3 - a1)):\\n m =3D matrix([[1, 0, 0],\\n [0, 1, 0],\\n [0, m32, 1]])\\n for g in _gl2_coset_gamma0(a3 - a1, p):\\n n =3D block_diagonal_matrix(g, matrix([[1]]))\\n yield w23 * m * n\\n\\n\\ndef __gl3_coset_gamma0_1_2(a1, a2, p):\\n w12 =3D matrix([[0, 1, 0],\\n [1, 0, 0],\\n [0, 0, 1]])\\n\\n for m12 in range(p ** (a2 - a1 - 1)):\\n for m13 in range(p ** (a2 - a1 - 1)):\\n m =3D matrix([[1, p * m12, p * m13],\\n [0, 1, 0],\\n [0, 0, 1]])\\n yield m\\n for m21 in range(p ** (a2 - a1)):\\n m =3D matrix([[1, 0, 0],\\n [m21, 1, 0],\\n [0, 0, 1]])\\n for g in _gl2_coset_gamma0(a2 - a1, p):\\n n =3D block_diagonal_matrix(matrix([[1]]), g)\\n yield w12 = * m * n\\n\\n\\ndef __gl3_coset_gamma0_distinct(a1, a2, a3, p):\\n\\n w12 =3D matrix([[0, 1, 0],\\n [1, 0, 0],\\n [= 0, 0, 1]])\\n\\n w23 =3D matrix([[1, 0, 0],\\n [0, 0, 1],\= \n [0, 1, 0]])\\n\\n w13 =3D matrix([[0, 0, 1],\\n [0, 1, 0],\\n [1, 0, 0]])\\n\\n w123 =3D matrix([[0, 1, 0],\\n [0, 0, 1],\\n [1, 0, 0]])\\n\\n w132 =3D matrix([[0, 0, 1],\\n [1, 0, 0],\\n [0, 1, 0]])\\n\\n # w =3D 1\\n for m12 in range(p ** (a2 - a1 - 1)):\\n for m13 in range(p ** (a3 - a1 - 1)):\\n for m23 in range(p ** (a3 - a2 - 1)):\\n yield matrix([[1, p * m12, p * m13],\\n [0, 1, p * m23],\\n [0, 0, 1]])\\n # w =3D (12)\\n for m13 in range(p ** (a3 - a2 - 1)):\\n for m21 in range(p ** (a2 - a1)):\\n for m23 in range(p ** (a3 - a1 - 1)):\\n m =3D matrix([[1, 0, p * m13],\\n [m21, 1, p * m23],\\n [0, 0, 1]])\\n yield w12 * m\\n # w =3D (23)\\n for m12 in range(p ** (a3= - a1 - 1)):\\n for m13 in range(p ** (a2 - a1 - 1)):\\n for m32 in range(p ** (a3 - a2)):\\n m =3D matrix([[1, p * m12, = p * m13],\\n [0, 1, 0],\\n [0, m32, 1]])\\n yield w23 * m\\n\\n # w =3D (13)\\n for m21 in range(p ** (a3 - a2)):\\n for m31 in range(p ** (a3 - a1)):\\n for m32 in range(p ** (a2 - a1)):\\n m = =3D matrix([[1, 0, 0],\\n [m21, 1, 0],\\n [m31, m32, 1]])\\n yield w13 * m\\n\\n # w =3D (123)\\n for m21 in range(p ** (a3 - a1)):\\n for m23 in range(p ** (a2 - a1 - 1)):\\n for m31 in range(p ** (a3 - a2)):\\n m =3D matrix([[1, 0, 0],\\n [m21, 1, p * m23],\\n [m31, 0, 1]])\\n yield w123 * m\\n # w =3D (132)\\n for m12 in range(p ** (a3 - a2 - 1)):\\n for m31 in range(p ** (a2 - a1)):\\n for m32 in range(p ** (a3 - a1)):\\n m =3D matrix([[1, p * m12, 0],\= \n [0, 1, 0],\\n [m31, m32, 1]])\\n yield w132 * m\\n\\n\\nclass HalfIntMatElement(object):\\n\\n def __init__(self, T):\\n '''\\n :params T: half integral matrix of size 3 or a list\\n '''\\n if isinstance(T, list):\\n a, b, c, d, e, f =3D [ZZ(x) fo= r x in T]\\n mat =3D matrix([[a, f / 2, e / 2],\\n [f / 2, b, d / 2],\\n [e / 2, d / 2, c]])\\n else:\\n mat =3D T\\n self.__entries =3D tuple(mat.list())\\n\\n def __eq__(self, other):\\n if isinstance(other, HalfIntMatElement):\\n return self.__entries =3D=3D other.__entries\\n else:\\n raise NotImplementedError\\n\\n def __repr__(self):\\n return self.T.__repr__()\\n\\n def __hash__(self):\\n return hash(self.__entries)\\n\\n @property\\n def T(self):\\n return matrix(3, self.__entries)\\n\\n def right_action(self, g):\\n '''\\n :param g: matrix of size n\\n return self[g] (Siegel's notation)\\n '''\\n S =3D g.transpose() * self.T * g\\n return HalfIntMatElement(S)\\n\\n def satisfy_cong_condition_tp(self, p, alpha):\\n '''\\n Test if sum_{B mod D} exp(2pi T B D^(-1)) is zero, where D =3D diag(p^a1, p^a2, a^a3),\\n a1, a2, a3 =3D alpha.\\n '''\\n return (all(ZZ(self.T[i, i]) % p ** alpha[i] =3D=3D 0 for i in range(3)) and\\n all(ZZ(self.T[i, j] * 2) % p ** alpha[i] =3D=3D 0\\n for i in range(3) for j in range(i + 1, 3)))\\n\\n def is_divisible_by(self, m):\\n '''\\n Test if self is divisible by m\\n :param m: integer\\n '''\\n return _half_int_mat_is_div_by(self.T, m)\\n\\n def __floordiv__(self, other):\\n S =3D matrix(QQ, 3)\\n for i in range(3):\\n S[i, i] =3D ZZ(self.T[i, i]) // other\\n for i in range(3):\\n for j in range(i + 1, 3):\\n S[i, j] =3D S[j, i] =3D (ZZ(self.T[i, j] * 2) // other) / 2\\n return HalfIntMatElement(S)\\n\\n\\ndef alpha_list(dl):\\n '''\\n Return a list of (a0, a1, a2) with 0 <=3D a0 <=3D a1 <=3D a2 <=3D dl\\n '''\\n = return [(a0, a1, a2) for a0 in range(dl + 1)\\n for a1 in range(a0, dl + 1) for a2 in range(a1, dl + 1)]\\n\\n\\ndef tp_action_fourier_coeff(p, T, F):\\n '''\\n Return the Tth Fourier coefficient of F|T(p), where F is a modular form.\\n :param p: a prime number\\n :param T: a half integral matrix or an instance of HalfIntMatElement\\n :param F: a dictionary or a Siegel modular form of degree 3\\n '''\\n p =3D ZZ(p)\\n return _action_fc_base(tp_action_fc_alist(p, T), F, T)\\n\\n\\ndef tp2_action_fourier_coeff(p, i, T, F):\\n '''\\n Similar to tp_action_fourier_coeff for T_i(p^2).\\n '''\\n p =3D ZZ(p)\\n return _action_fc_base(tp2_action_fc_alist(p, T, i), F, T)\\n\\n\\ndef _action_fc_base(ls, F, T):\\n if not isinstance(T, HalfIntMatElement):\\n T =3D HalfIntMatElement(T)\\n res =3D 0\\n for s, a, g in ls:\\n res =3D a * F[s].left_action(g) + res\\n return res\\n\\n\\ndef hecke_eigenvalue_tp(p, F, T=3DNone):\\n '''\\n p, F, T: same as aruments of tp_action_fourier_coeff.\\n Assuming F is an eigenform, return the eigenvalue for T(p),\\n T is used for the computation of Fourier coefficients.\\n If T is omitted, T will be set to\\n matrix([[1, 1/2, 1/2], [1/2, 1, 1/2], [1/2, 1/2, 1]]).\\n '''\\n return _hecke_eigenvalue_base(lambda s: tp_action_fourier_coeff(p, s, F), F, T=3DT)\\n\\n\\ndef hecke_eigenvalue_tp2(p, i, F, T=3DNone):\\n '''\\n Similar to hecke_eigenvalue_tp for T(p^2).\\n '''\\n return _hecke_eigenvalue_base(lambda s: tp2_action_fourier_coeff(p, i, s, F), F, T=3DT)\\n\\n\\ndef spinor_l_euler_factor(p, F, t=3DNone, T=3DNone):\\n '= ''\\n F: a dict or Siegel modular form of degree 3.\\n Return a polynomial G(t) of degree 8, s.t.\\n G(p^(-s))^(-1) is the p-Euler factor of the spinor L function of F.\\n '''\\n p =3D ZZ(p)\\n if t is None:\\n t =3D PolynomialRing(QQ, 1, names=3D't', order=3D\\\"neglex\\\").gens()[0]\\n c =3D {}\\n tp =3D hecke_eigenvalue_tp(p, F, T=3DT)\\n tpp1, tpp2, tpp3 =3D [hecke_eigenvalue_tp2(p, i, F, T=3DT) for i in [1, 2, 3]]\\n c[0] =3D ZZ(1)\\n c[1] =3D tp\\n c[2] =3D p * (tpp1 + (p**2 + 1) * tpp2 + (p**= 2 + 1)**2 * tpp3)\\n c[3] =3D p**3 * tp * (tpp2 + tpp3)\\n c[4] =3D p**6 = * (tp**2 * tpp3 + tpp2**2 - 2 * p * tpp1 * tpp3 -\\n 2 * (p - 1) * tpp2 * tpp3 -\\n (p**6 + 2 * p**5 + 2 * p**3 + 2 * p - 1) * tpp3**2)\\n c[5] =3D p**6 * tpp3 * c[3]\\n c[6] =3D p**12 * = tpp3 ** 2 * c[2]\\n c[7] =3D p**18 * tpp3 ** 3 * c[1]\\n c[8] =3D p**24 * = tpp3 ** 4\\n return sum((-1)**k * v * t**k for k, v in c.items())\\n\\n\\ndef rankin_convolution_degree1(f, g, p, name=3DNone):\\n u'''\\n f, g: primitive forms of degree 1 and level 1.\\n Return p-euler factor of the Rankin convolution of f and g as\\n a polynomial.\\n '''\\n k1 =3D f.weight()\\n k2 =3D g.weight()\\n ap =3D f[p]\\n bp =3D g[p]\\n = t =3D PolynomialRing(QQ, 1, names=3D't' if name is None else name,\\n order=3D\\\"neglex\\\").gens()[0]\\n return (1 - ap * bp * t +\\= n (ap**2 * p**(k2 - 1) + bp**2 * p**(k1 - 1) - 2 * p**(k1 + k2 - 2)) * t**2 -\\n ap * bp * p**(k1 + k2 - 2) * t**3 + p**(2 * (k1 + k2 - 2)) * t**4)\\n\\n\\ndef _hecke_eigenvalue_base(fc_func, F, T=3DNone):\\n if T is None:\\n T =3D HalfIntMatElement(matrix([[ZZ(1), ZZ(1) / ZZ(2), ZZ(1) / ZZ(2)],\\n [ZZ(1) / ZZ(2), ZZ(1), ZZ(1) / ZZ(2)],\\n [ZZ(1) / ZZ(2), ZZ(1) / ZZ(2), ZZ(1)]]))\\n if not isinstance(T, HalfIntMatElement):\\n T =3D HalfIntMatElement(T)\\n v1 =3D fc_func(T).vector\\n v =3D F[T].vector= \\n if v =3D=3D 0:\\n raise ZeroDivisionError\\n else:\\n i= =3D next(i for i in range(len(v)) if v[i] !=3D 0)\\n return v1[i] / v[i]\\n\\n\\n@cached_function\\ndef tp_action_fc_alist(p, T):\\n '''\\n return a list of tuples (S, a, g) s.t.\\n S: an instance of HalfIntMatElement\\n a: integer\\n g: 3 by 3 matrix s.t.\\n F|T(p) =3D sum(a rho(g) F[S] | (a, g, S)).\\n '''\\n res1 =3D []\\n for a= lpha in alpha_list(1):\\n D =3D diagonal_matrix([p ** a for a in alpha])\= \n for V in _gl3_coset_gamma0(alpha, p):\\n M =3D D * V\\n S =3D T.right_action(M.transpose())\\n if S.is_divisible_by(p):\\n S =3D S // p\\n if S.satisfy_cong_condition_tp(p, alpha):\\n # p**(-6) and p in the third item are for normalization.\\n res1.append(\\n (S, p ** (-6) * mul(p ** alpha[i] for i in range(3) for j in range(i, 3)),\\n M ** (-1) * p))\\n return __convert_reduced_nonisom_matrices(res1)\\n\\n\\ndef __convert_reduced_nonisom_matrices(alst):\\n red_res =3D []\\n for s, a, g in alst:\\n u =3D _minkowski_reduction_transform_matrix(s.T)\\n t =3D s.right_action(u)\\n red_res.append((t, a, g * u.transpose() ** (-1)))\\n\\n non_isoms =3D []\\n\\n for s, a, g in red_res:\\n q =3D QuadraticForm(ZZ, 2 * s.T)\\n u =3D None\\n for t, _, _ in non_isoms:\\n q1 =3D QuadraticForm(ZZ, 2 * t.T)\\n if q.det() =3D=3D q1.det():\\n u =3D q.is_globally_equivalent_to(q1, return_matrix=3DTrue)\\n if = u and u.transpose() * q.Gram_matrix_rational() * u =3D=3D q1.Gram_matrix_rational():\\n break\\n if u:\\n non_isoms.append((s.right_action(u), a, g * u.transpose() ** (-1)))\\n else:\\n non_isoms.append((s, a, g))\\n return non_isoms\\n\\n\\n@cached_function\\ndef tp2_action_fc_alist(p, T, i):\\n '''\\n similar to tp_action_fc_alist for T_i(p^2) for i =3D 0, 1, 2, 3.\\n '''\\n res1 =3D []\\n\\n for alpha in alpha_list(2):\\= n D =3D diagonal_matrix([p ** a for a in alpha])\\n for V in _gl3_coset_gamma0(alpha, p):\\n M =3D D * V\\n S =3D T.right_action(M.transpose())\\n if S.is_divisible_by(p ** 2):\\n S =3D S // (p ** 2)\\n res1.append((S,= p ** (-12) * _expt_sum(S, p, alpha, i),\\n M ** (-1) * p ** 2))\\n\\n return __convert_reduced_nonisom_matrices([(a, b, c) for a, b, c in res1 if b !=3D 0])\\n\\n\\ndef _nearest_integer(x):\\n = r =3D floor(x)\\n if x - r > 0.5:\\n return r + 1\\n else:\\n return r\\n\\n\\ndef _gaussian_reduction(b1, b2, S):\\n '''\\n b1, b2: vectors of length 3\\n S: symmetric matrix of size 3\\n '''\\n while True:\\n nb1 =3D b1 * S * b1\\n nb2 =3D b2 * S * b2\\n if nb2 < nb1:\\n b1, b2 =3D b2, b1\\n x =3D (b2 * S * = b1) / (b1 * S * b1)\\n r =3D _nearest_integer(x)\\n a =3D b2 - r = * b1\\n if a * S * a >=3D b2 * S * b2:\\n return (b1, b2)\\= n else:\\n b1, b2 =3D a, b1\\n\\n\\ndef _sym_mat_gen(p, n):\\n if n =3D=3D 1:\\n for a in range(p):\\n yield matrix([[a]])\\n else:\\n for s in _sym_mat_gen(p, n - 1):\\n ls =3D [range(p) for _ in range(n)]\\n for a in itertools.product(*ls):\\n v =3D matrix([a[:-1]])\\n yield block_matrix([[s, v.transpose()], [v, matrix([[a[-1]]])]])\\n\\n\\ndef _gen_gauss_sum_direct_way(N, p, r):\\n res =3D 0\\n K =3D CyclotomicField(p)\\n zeta =3D K.gen()\\n for = S in _sym_mat_gen(p, N.ncols()):\\n if S.change_ring(FiniteField(p)).rank() =3D=3D r:\\n res +=3D zeta = ** ((N * S).trace())\\n try:\\n return QQ(res)\\n except TypeError:\\n return res\\n\\n\\ndef _generalized_gauss_sum(N, p, r):\\n if r =3D=3D 0:\\n return 1\\n if p =3D=3D 2:\\n = return _gen_gauss_sum_direct_way(N, p, r)\\n else:\\n N_mp =3D N.change_ring(FiniteField(p))\\n d, _, v =3D N_mp.smith_form()\\n t =3D d.rank()\\n N1 =3D (v.transpose() * N_mp *\\n v).matrix_from_rows_and_columns(range(t), range(t))\\n eps =3D kronecker_symbol(N1.det(), p)\\n return _gen_gauss_sum_non_dyadic(p, eps, N.ncols(), t, r)\\n\\n\\ndef _half_int_mat_is_div_by(S, m):\\n n = =3D S.ncols()\\n return (all(ZZ(S[i, i]) % m =3D=3D 0 for i in range(n)) and= \\n all(ZZ(2 * S[i, j]) % m =3D=3D 0 for i in range(n) for j in rang= e(i + 1, n)))\\n\\n\\n@cached_function\\ndef _gen_gauss_sum_non_dyadic(p, eps, n, t, r):\\n '''\\n cf. H. Saito, a generalization of Gauss sums\\n '''\\n\\n def parenthesis_prod(a, b, m):\\n if m =3D=3D 0:\\n return 1\\n else:\\n return mul(1 - a * b ** i for i in range(m))\\n\\n if (n - t) % 2 =3D=3D 0:\\n m =3D (n - t) // 2= \\n else:\\n m =3D (n - t + 1) // 2\\n\\n if n =3D=3D r:\\n i= f n % 2 =3D=3D 1:\\n return ((-1) ** ((n - 2 * m + 1) // 2) * p ** ((n= ** 2 + (2 * m) ** 2 - 1) // 4) *\\n parenthesis_prod(p ** (-1), p ** (-2), m))\\n elif n % 2 =3D=3D t % 2 =3D=3D 0:\\n return ((-kronecker_symbol(-1, p)) ** ((n - 2 * m) // 2) *\\n eps * p ** ((n ** 2 + (2 * m + 1) ** 2 - 1) // 4) *\\n parenthesis_prod(p ** (-1), p ** (-2), m))\\n else:\\n return 0\\n else:\\n diag =3D [1 for _ in range(t)]\\n = if eps =3D=3D -1:\\n diag[-1] =3D least_quadratic_nonresidue(p)\\n diag =3D diag + [0 for _ in range(n - t)]\\n N =3D diagonal_matrix(diag).change_ring(FiniteField(p))\\n return _gen_gauss_sum_direct_way(N, p, r)\\n\\n\\ndef _expt_sum(S, p, alpha, i):\\n '''\\n Return the exponential sum in Miyawaki's paper, where alpha[-1] <=3D 2, for T_i(p^2).\\n '''\\n a, b, c =3D [alpha.count(_i= ) for _i in range(3)]\\n S33 =3D S.T.matrix_from_rows_and_columns(range(a = + b, 3), range(a + b, 3))\\n S22 =3D S.T.matrix_from_rows_and_columns(range(a, a + b), range(a, a + b))\\n S32 =3D S.T.matrix_from_rows_and_columns(range(a + b, 3), range(a))\\n\\n if c > 0 and not _half_int_mat_is_div_by(S33, p ** 2):\\n return 0\\n if c > 0 and b > 0 and any(x % p !=3D 0 for x in (S32 * ZZ(2)).change_ring(ZZ).list()):\\n return 0\\n\\n if b =3D=3D 0 a= nd a + c =3D=3D 3 - i:\\n return p ** (c * (c + 1))\\n elif b =3D=3D 0= :\\n return 0\\n else:\\n return p ** (c * (c + 1)) * p ** (b * c) * _generalized_gauss_sum(S22, p, b - i)\\n\\n\\ndef _minkowski_reduction(b1, b2, b3, S):\\n\\n def inner_prod(x, y):\\n return x * S * y\\n\\n while True:\\n b1, b2, b3 =3D sorted([b= 1, b2, b3], key=3Dlambda b: b * S * b)\\n\\n b1, b2 =3D _gaussian_reduction(b1, b2, S)\\n\\n b11 =3D inner_prod(b1, b1)\\n b12 =3D inner_prod(b1, b2)\\n b13 =3D inner_prod(b1, b3)\\n b22 =3D inner_prod(b2, b2)\\n b23 =3D inner_prod(b2, b3)\\n = b33 =3D inner_prod(b3, b3)\\n\\n y1 =3D - (b13 / b11 - b12 * b23 / (b11 = * b22)) / \\\\\\n (1 - b12 ** 2 / (b11 * b22))\\n y2 =3D - (b23 / b22 - b12 * b13 / (b11 * b22)) / \\\\\\n (1 - b12 ** 2 / (b11 * b22))\\n\\n # Find integers x1, x2 so that norm(b3 + x2 * b2 + x1 * b1) is minimal.\\n a_norms_alst =3D []\\n\\n for x1 in [floor(y1), ceil(y1)]:\\n for x2 in [floor(y2), ceil(y2)]:\\n a =3D b3 + x2 * b2 + x1 * b1\\n a_norms_alst.append((x1, x2, a, inner_prod(a, a)))\\n _inner_prod_a =3D min(x[-1] for x in a_norms_alst)\\n x1, x2, a, _ =3D next(x for = x in a_norms_alst if x[-1] =3D=3D _inner_prod_a)\\n\\n if _inner_prod_a >= =3D b33:\\n # Change sings of b1, b2, b3 and terminate the alogrithm\\n sngs =3D [sgn(b12), sgn(b13), sgn(b23)]\\n bs =3D [b1, b2, b3]\\n try:\\n # If b12, b13 or b23 is zero, change sgns of b1, b2, b3 so that\\n # b12, b13, b23 >=3D 0.\\n zero_i =3D sngs.index(0)\\n set_ls =3D [set([1, 2]), set([1, 3]), set([2, 3])]\\n t =3D set_ls[zero_i]\\n _other =3D [x for x in [1, 2, 3] if x not = in t][0]\\n for x in t:\\n i =3D set_ls.index(set([x, _other]))\\n if sngs[i] < 0:\\n bs[x - 1] *=3D -1\\n b1, b2, b3 =3D bs\\n except ValueError:\\n # Else change sgns so that b12, b13 > 0\\n if b12 < 0:\\n b2 =3D -b2\\n if b13 < 0:\\n b3 =3D -b3\\n retur= n (b1, b2, b3)\\n else:\\n b3 =3D a\\n\\n\\ndef _minkowski_reduction_transform_matrix(S):\\n '''\\n Return a unimodular matrix u such that u^t * S * u is reduced in Minkowski's sense.\\n '''\\n b1, b2, b3 =3D identity_matrix(QQ, 3).columns()\\n c1, c2, c3 =3D _minkowski_reduction(b1, b2, b3, S)\\n return matrix([c1= , c2, c3]).transpose()\\n\",\"line\":52,\"column\":41,\"path\":\"/home/sho/work/s= age_packages/e8theta_degree3/hecke_module.py\"}}" The file contains a multibyte string "=E2=88=A7" and anaconda-mode converts= it to "\342\210\247". Sho Takemori 2016-07-31 23:31 GMT+09:00 Eli Zaretskii : > > From: Sho Takemori > > Date: Sun, 31 Jul 2016 17:26:37 +0900 > > > > I got an error "error in process sentinel: url-http-create-request: > Multibyte text in HTTP request" when I visited a > > Python file which contains a multibyte character with > `anaconda-eldoc-mode' turned on. > > That file name should have been encoded by the time it is passed to > url-http.el, so the problem should not have happened, because encoded > strings are unibyte strings. > > > At first, I thought this was a bug of anaconda-mode. So I opened an > issue in github > > (https://github.com/proofit404/anaconda-mode/issues/189). > > > > I guess `(=3D (string-bytes request) (length request))` in > `url-http-create-request' should be `(=3D (string-bytes > > url-http-data) (length url-http-data))`, because `(=3D (string-bytes > request) (length request))` may be `nil' even if > > `(=3D (string-bytes url-http-data) (length url-http-data))` is `t'. > > I don't think I agree in general: all the strings that are used by > url-http-create-request should be unibyte strings. if they all are > unibyte strings, then I think the situation you describe should not > happen. However, you didn't provide enough details to analyze the > situation, so perhaps I'm missing something. Could you please show > all the details, specifically, what were the values of the various > variables used by url-http-create-request to generate the request? > For each value that is a string, please also tell whether it's a > unibyte or a multibyte string. > > Thanks. > --94eb2c0481aef25b020538f6be7f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
It seems that anaconda-mode use two global variables = (url-request-method and url-request-data)
to make generate the re= quest.


<= div>url-request-method is bound to an ASCII string "POST".
<= div>In my situation, url-request-data is bound to a unibyte string as below= .

"{\"jsonrpc\":\"2.0\",\= "id\":1,\"method\":\"eldoc\",\"params\&q= uot;:{\"source\":\"# -*- coding: utf-8 -*-\\nimport itertool= s\\nfrom itertools import groupby\\n\\nfrom sage.all import mul\\nfrom sage= .arith.all import kronecker_symbol\\nfrom sage.functions.all import ceil, f= loor, sgn\\nfrom sage.matrix.all import (block_diagonal_matrix, block_matri= x,\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 diagonal_matrix, identity_matrix, matrix)\\nfr= om sage.misc.all import cached_function\\nfrom sage.quadratic_forms.all imp= ort QuadraticForm, least_quadratic_nonresidue\\nfrom sage.rings.all import = QQ, ZZ, CyclotomicField, FiniteField, PolynomialRing\\n\\n\\ndef _index_of_= gamma_0_gl_n(alpha, p):\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0Ret= urns delta(a1, ..., an) defined in Shimura, Euler products and Eisenstein\\= n =C2=A0 =C2=A0series, pp 118, (15.1.7).\\n =C2=A0 =C2=A0'''\\n= =C2=A0 =C2=A0if p in ZZ:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0p =3D ZZ(p)\\n\\n = =C2=A0 =C2=A0def _bn(n):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return mul(1 - p ** = (-i) for i in xrange(1, n + 1))\\n\\n =C2=A0 =C2=A0e_r_ls =3D [(k, len(list= (v)))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for k, v in groupb= y(sorted(alpha), lambda x: x)]\\n =C2=A0 =C2=A0res =3D _bn(len(alpha)) / mu= l(_bn(r) for _, r in e_r_ls)\\n =C2=A0 =C2=A0for i, (ei, ri) in enumerate(e= _r_ls):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for j, (ej, rj) in enumerate(e_r_ls):= \\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if i < j:\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0res *=3D p ** ((ej - ei) * ri * rj= )\\n =C2=A0 =C2=A0return res\\n\\n\\ndef _gl2_coset_gamma0(a, p):\\n =C2=A0= =C2=A0w =3D matrix([[0, -1],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0[1, 0]])\\n =C2=A0 =C2=A0for m12 in range(p ** a):\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0yield matrix([[1, m12],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 1]])\\n =C2=A0 =C2=A0fo= r m21 in range(p ** (a - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix([[= 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0[p * m21, 1]])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0yield w * m\\n\\n\\ndef = _gl3_coset_gamma0(alpha, p):\\n =C2=A0 =C2=A0r'''\\n =C2=A0 =C2= =A0Let alpha =3D [a0, a1, a2] with a0 <=3D a1 <=3D a2,\\n =C2=A0 =C2= =A0g =3D diag([p^a0, p^a1, p^a2]), and Gamma0 =3D g^(-1) GL3(Z) g \342\210\= 247 GL3(Z).\\n =C2=A0 =C2=A0Return a complete set Gamma0 \\\\ GL3(Z).\\n = =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0if p in ZZ:\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0p =3D ZZ(p)\\n =C2=A0 =C2=A0a0, a1, a2 =3D alpha\\n =C2=A0 =C2= =A0if a0 < a1 < a2:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return list(__gl3_c= oset_gamma0_distinct(a0, a1, a2, p))\\n =C2=A0 =C2=A0elif a0 =3D=3D a1 and = a1 < a2:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return list(__gl3_coset_gamma0_2_= 1(a0, a2, p))\\n =C2=A0 =C2=A0elif a0 < a1 and a1 =3D=3D a2:\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0return list(__gl3_coset_gamma0_1_2(a0, a2, p))\\n =C2= =A0 =C2=A0elif a0 =3D=3D a1 =3D=3D a2:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return= [identity_matrix(ZZ, 3)]\\n =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0raise ValueError\\n\\n\\ndef __gl3_coset_gamma0_2_1(a1, a3, p):\\n =C2= =A0 =C2=A0w23 =3D matrix([[1, 0, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 0, 1],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 1, 0]])\\n =C2=A0 =C2=A0for m13 in range(p = ** (a3 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for m23 in range(p ** (a3 = - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix([[1, 0= , p * m13],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0[0, 1, p * m23],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 0, 1]])\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0yield m\\n\\n =C2=A0 =C2=A0for m32 in ran= ge(p ** (a3 - a1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix([[1, 0, 0],\= \n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0,= 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0[0, m32, 1]])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for g in _gl2_coset_gamma= 0(a3 - a1, p):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0n =3D block_diag= onal_matrix(g, matrix([[1]]))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0y= ield w23 * m * n\\n\\n\\ndef __gl3_coset_gamma0_1_2(a1, a2, p):\\n =C2=A0 = =C2=A0w12 =3D matrix([[0, 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0[1, 0, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 0, 1]])\\n\\n =C2=A0 =C2=A0for m12 in range(= p ** (a2 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for m13 in range(p ** (a= 2 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix([[1,= p * m12, p * m13],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 0, 1]])\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0yield m\\n =C2=A0 =C2=A0for m21 in ra= nge(p ** (a2 - a1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix([[1, 0, 0],= \\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[m= 21, 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0[0, 0, 1]])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for g in _gl2_coset_gam= ma0(a2 - a1, p):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0n =3D block_di= agonal_matrix(matrix([[1]]), g)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0yield w12 * m * n\\n\\n\\ndef __gl3_coset_gamma0_distinct(a1, a2, a3, p)= :\\n\\n =C2=A0 =C2=A0w12 =3D matrix([[0, 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[1, 0, 0],\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 0, 1]])\\n\\n =C2=A0 =C2=A0w23= =3D matrix([[1, 0, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0[0, 0, 1],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0[0, 1, 0]])\\n\\n =C2=A0 =C2=A0w13 =3D matrix([[0, 0, 1],\= \n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 1, 0],= \\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[1, 0, 0]= ])\\n\\n =C2=A0 =C2=A0w123 =3D matrix([[0, 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [0, 0, 1],\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [1, 0, 0]])\\n\\n =C2=A0 =C2= =A0w132 =3D matrix([[0, 0, 1],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 [1, 0, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 [0, 1, 0]])\\n\\n =C2=A0 =C2=A0# w =3D 1\\n =C2=A0= =C2=A0for m12 in range(p ** (a2 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0= for m13 in range(p ** (a3 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0for m23 in range(p ** (a3 - a2 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0yield matrix([[1, p * m12, p * m13],\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0[0, 1, p * m23],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0= , 0, 1]])\\n =C2=A0 =C2=A0# w =3D (12)\\n =C2=A0 =C2=A0for m13 in range(p *= * (a3 - a2 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for m21 in range(p ** (a2 -= a1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for m23 in range(p ** (a= 3 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m = =3D matrix([[1, 0, p * m13],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[m21, 1, p * m23],\\= n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0[0, 0, 1]])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0yield w12 * m\\n =C2=A0 =C2=A0# w =3D (23)\\n =C2=A0 = =C2=A0for m12 in range(p ** (a3 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0f= or m13 in range(p ** (a2 - a1 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0for m32 in range(p ** (a3 - a2)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix([[1, p * m12, p * m13],\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0[0, 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, m32, 1]])\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0yield w23 * m\\n\\n =C2=A0 = =C2=A0# w =3D (13)\\n =C2=A0 =C2=A0for m21 in range(p ** (a3 - a2)):\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0for m31 in range(p ** (a3 - a1)):\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0for m32 in range(p ** (a2 - a1)):\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix([[1, 0, 0],\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0[m21, 1, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[m31, m32, 1]= ])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0yield w13 * m\= \n\\n =C2=A0 =C2=A0# w =3D (123)\\n =C2=A0 =C2=A0for m21 in range(p ** (a3 = - a1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for m23 in range(p ** (a2 - a1 - 1)):= \\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for m31 in range(p ** (a3 - a2= )):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m =3D matrix(= [[1, 0, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[m21, 1, p * m23],\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0[m31, 0, 1]])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0yield w123 * m\\n =C2=A0 =C2=A0# w =3D (132)\\n =C2=A0 =C2=A0for m12= in range(p ** (a3 - a2 - 1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for m31 in ran= ge(p ** (a2 - a1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for m32 in = range(p ** (a3 - a1)):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0m =3D matrix([[1, p * m12, 0],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[0, 1, 0],\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0[m31, m32, 1]])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0yield w132 * m\\n\\n\\nclass HalfIntMatElement(obje= ct):\\n\\n =C2=A0 =C2=A0def __init__(self, T):\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0'''\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0:params T: half integral m= atrix of size 3 or a list\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0'''\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0if isinstance(T, list):\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0a, b, c, d, e, f =3D [ZZ(x) for x in T]\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mat =3D matrix([[a, f / 2, e / 2],\\n =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0[f / 2, b, d / 2],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[e / 2, d / 2, c]])\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0m= at =3D T\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0self.__entries =3D tuple(mat.list())= \\n\\n =C2=A0 =C2=A0def __eq__(self, other):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0= if isinstance(other, HalfIntMatElement):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0return self.__entries =3D=3D other.__entries\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0else:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise NotImplem= entedError\\n\\n =C2=A0 =C2=A0def __repr__(self):\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0return self.T.__repr__()\\n\\n =C2=A0 =C2=A0def __hash__(self):\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0return hash(self.__entries)\\n\\n =C2=A0 =C2=A0@= property\\n =C2=A0 =C2=A0def T(self):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return = matrix(3, self.__entries)\\n\\n =C2=A0 =C2=A0def right_action(self, g):\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0:p= aram g: matrix of size n\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return self[g] (Sieg= el's notation)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0'''\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0S =3D g.transpose() * self.T * g\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0return HalfIntMatElement(S)\\n\\n =C2=A0 =C2=A0def satisfy_cong_c= ondition_tp(self, p, alpha):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0'''\= \n =C2=A0 =C2=A0 =C2=A0 =C2=A0Test if sum_{B mod D} exp(2pi T B D^(-1)) is = zero, where D =3D diag(p^a1, p^a2, a^a3),\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0a1,= a2, a3 =3D alpha.\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0'''\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0return (all(ZZ(self.T[i, i]) % p ** alpha[i] =3D=3D 0 f= or i in range(3)) and\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0all(ZZ(self.T[i, j] * 2) % p ** alpha[i] =3D=3D 0\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for i in range(3) fo= r j in range(i + 1, 3)))\\n\\n =C2=A0 =C2=A0def is_divisible_by(self, m):\\= n =C2=A0 =C2=A0 =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0= Test if self is divisible by m\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0:param m: inte= ger\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0return _half_int_mat_is_div_by(self.T, m)\\n\\n =C2=A0 =C2=A0def __fl= oordiv__(self, other):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0S =3D matrix(QQ, 3)\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0for i in range(3):\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0S[i, i] =3D ZZ(self.T[i, i]) // other\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0for i in range(3):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fo= r j in range(i + 1, 3):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0S[i, j] =3D S[j, i] =3D (ZZ(self.T[i, j] * 2) // other) / 2\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0return HalfIntMatElement(S)\\n\\n\\ndef alpha_list(= dl):\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0Return a list of (a0, = a1, a2) with 0 <=3D a0 <=3D a1 <=3D a2 <=3D dl\\n =C2=A0 =C2=A0= '''\\n =C2=A0 =C2=A0return [(a0, a1, a2) for a0 in range(dl + 1= )\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for a1 in range(a0, dl + 1) f= or a2 in range(a1, dl + 1)]\\n\\n\\ndef tp_action_fourier_coeff(p, T, F):\\= n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0Return the Tth Fourier coeff= icient of F|T(p), where F is a modular form.\\n =C2=A0 =C2=A0:param p: a pr= ime number\\n =C2=A0 =C2=A0:param T: a half integral matrix or an instance = of HalfIntMatElement\\n =C2=A0 =C2=A0:param F: a dictionary or a Siegel mod= ular form of degree 3\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0p =3D= ZZ(p)\\n =C2=A0 =C2=A0return _action_fc_base(tp_action_fc_alist(p, T), F, = T)\\n\\n\\ndef tp2_action_fourier_coeff(p, i, T, F):\\n =C2=A0 =C2=A0'&= #39;'\\n =C2=A0 =C2=A0Similar to tp_action_fourier_coeff for T_i(p^2).\= \n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0p =3D ZZ(p)\\n =C2=A0 =C2= =A0return _action_fc_base(tp2_action_fc_alist(p, T, i), F, T)\\n\\n\\ndef _= action_fc_base(ls, F, T):\\n =C2=A0 =C2=A0if not isinstance(T, HalfIntMatEl= ement):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0T =3D HalfIntMatElement(T)\\n =C2=A0 = =C2=A0res =3D 0\\n =C2=A0 =C2=A0for s, a, g in ls:\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0res =3D a * F[s].left_action(g) + res\\n =C2=A0 =C2=A0return res\\n\\= n\\ndef hecke_eigenvalue_tp(p, F, T=3DNone):\\n =C2=A0 =C2=A0'''= ;\\n =C2=A0 =C2=A0p, F, T: same as aruments of tp_action_fourier_coeff.\\n = =C2=A0 =C2=A0Assuming F is an eigenform, return the eigenvalue for T(p),\\n= =C2=A0 =C2=A0T is used for the computation of Fourier coefficients.\\n =C2= =A0 =C2=A0If T is omitted, T will be set to\\n =C2=A0 =C2=A0matrix([[1, 1/2= , 1/2], [1/2, 1, 1/2], [1/2, 1/2, 1]]).\\n =C2=A0 =C2=A0'''\\n = =C2=A0 =C2=A0return _hecke_eigenvalue_base(lambda s: tp_action_fourier_coef= f(p, s, F), F, T=3DT)\\n\\n\\ndef hecke_eigenvalue_tp2(p, i, F, T=3DNone):\= \n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0Similar to hecke_eigenvalue= _tp for T(p^2).\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0return _hec= ke_eigenvalue_base(lambda s: tp2_action_fourier_coeff(p, i, s, F), F, T=3DT= )\\n\\n\\ndef spinor_l_euler_factor(p, F, t=3DNone, T=3DNone):\\n =C2=A0 = =C2=A0'''\\n =C2=A0 =C2=A0F: a dict or Siegel modular form of d= egree 3.\\n =C2=A0 =C2=A0Return a polynomial G(t) of degree 8, s.t.\\n =C2= =A0 =C2=A0G(p^(-s))^(-1) is the p-Euler factor of the spinor L function of = F.\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0p =3D ZZ(p)\\n =C2=A0 = =C2=A0if t is None:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0t =3D PolynomialRing(QQ, = 1, names=3D't', order=3D\\\"neglex\\\").gens()[0]\\n =C2= =A0 =C2=A0c =3D {}\\n =C2=A0 =C2=A0tp =3D hecke_eigenvalue_tp(p, F, T=3DT)\= \n =C2=A0 =C2=A0tpp1, tpp2, tpp3 =3D [hecke_eigenvalue_tp2(p, i, F, T=3DT) = for i in [1, 2, 3]]\\n =C2=A0 =C2=A0c[0] =3D ZZ(1)\\n =C2=A0 =C2=A0c[1] =3D= tp\\n =C2=A0 =C2=A0c[2] =3D p * (tpp1 + (p**2 + 1) * tpp2 + (p**2 + 1)**2 = * tpp3)\\n =C2=A0 =C2=A0c[3] =3D p**3 * tp * (tpp2 + tpp3)\\n =C2=A0 =C2=A0= c[4] =3D p**6 * (tp**2 * tpp3 + tpp2**2 - 2 * p * tpp1 * tpp3 -\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2 * (p - 1) * tpp2 = * tpp3 -\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = (p**6 + 2 * p**5 + 2 * p**3 + 2 * p - 1) * tpp3**2)\\n =C2=A0 =C2=A0c[5] = =3D p**6 * tpp3 * c[3]\\n =C2=A0 =C2=A0c[6] =3D p**12 * tpp3 ** 2 * c[2]\\n= =C2=A0 =C2=A0c[7] =3D p**18 * tpp3 ** 3 * c[1]\\n =C2=A0 =C2=A0c[8] =3D p*= *24 * tpp3 ** 4\\n =C2=A0 =C2=A0return sum((-1)**k * v * t**k for k, v in c= .items())\\n\\n\\ndef rankin_convolution_degree1(f, g, p, name=3DNone):\\n = =C2=A0 =C2=A0u'''\\n =C2=A0 =C2=A0f, g: primitive forms of degr= ee 1 and level 1.\\n =C2=A0 =C2=A0Return p-euler factor of the Rankin convo= lution of f and g as\\n =C2=A0 =C2=A0a polynomial.\\n =C2=A0 =C2=A0'= 9;'\\n =C2=A0 =C2=A0k1 =3D f.weight()\\n =C2=A0 =C2=A0k2 =3D g.weight()= \\n =C2=A0 =C2=A0ap =3D f[p]\\n =C2=A0 =C2=A0bp =3D g[p]\\n =C2=A0 =C2=A0t = =3D PolynomialRing(QQ, 1, names=3D't' if name is None else name,\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 order=3D\\\"neglex\\\").gens()[0]\\n =C2=A0 =C2=A0return (1 -= ap * bp * t +\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(ap**2 * p**(k2 = - 1) + bp**2 * p**(k1 - 1) - 2 * p**(k1 + k2 - 2)) * t**2 -\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ap * bp * p**(k1 + k2 - 2) * t**3 + p**(2 * = (k1 + k2 - 2)) * t**4)\\n\\n\\ndef _hecke_eigenvalue_base(fc_func, F, T=3DN= one):\\n =C2=A0 =C2=A0if T is None:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0T =3D Hal= fIntMatElement(matrix([[ZZ(1), ZZ(1) / ZZ(2), ZZ(1) / ZZ(2)],\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[ZZ(1) / ZZ(2), ZZ(1), ZZ(1= ) / ZZ(2)],\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[Z= Z(1) / ZZ(2), ZZ(1) / ZZ(2), ZZ(1)]]))\\n =C2=A0 =C2=A0if not isinstance(T,= HalfIntMatElement):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0T =3D HalfIntMatElement(= T)\\n =C2=A0 =C2=A0v1 =3D fc_func(T).vector\\n =C2=A0 =C2=A0v =3D F[T].vect= or\\n =C2=A0 =C2=A0if v =3D=3D 0:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0raise ZeroD= ivisionError\\n =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0i =3D next= (i for i in range(len(v)) if v[i] !=3D 0)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0ret= urn v1[i] / v[i]\\n\\n\\n@cached_function\\ndef tp_action_fc_alist(p, T):\\= n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0return a list of tuples (S, = a, g) s.t.\\n =C2=A0 =C2=A0S: an instance of HalfIntMatElement\\n =C2=A0 = =C2=A0a: integer\\n =C2=A0 =C2=A0g: 3 by 3 matrix s.t.\\n =C2=A0 =C2=A0F|T(= p) =3D sum(a rho(g) F[S] | (a, g, S)).\\n =C2=A0 =C2=A0'''\\n = =C2=A0 =C2=A0res1 =3D []\\n =C2=A0 =C2=A0for alpha in alpha_list(1):\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0D =3D diagonal_matrix([p ** a for a in alpha])\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0for V in _gl3_coset_gamma0(alpha, p):\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0M =3D D * V\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0S =3D T.right_action(M.transpose())\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0if S.is_divisible_by(p):\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0S =3D S // p\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if S.satisfy_cong_condition_tp(p, alpha):\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# p**= (-6) and p in the third item are for normalization.\\n =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0res1.append(\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(S= , p ** (-6) * mul(p ** alpha[i] for i in range(3) for j in range(i, 3)),\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 M ** (-1) * p))\\n =C2=A0 =C2=A0return __convert_reduced_nonisom= _matrices(res1)\\n\\n\\ndef __convert_reduced_nonisom_matrices(alst):\\n = =C2=A0 =C2=A0red_res =3D []\\n =C2=A0 =C2=A0for s, a, g in alst:\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0u =3D _minkowski_reduction_transform_matrix(s.T)\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0t =3D s.right_action(u)\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0red_res.append((t, a, g * u.transpose() ** (-1)))\\n\\n =C2=A0 =C2=A0non= _isoms =3D []\\n\\n =C2=A0 =C2=A0for s, a, g in red_res:\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0q =3D QuadraticForm(ZZ, 2 * s.T)\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0u =3D None\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for t, _, _ in non_isoms:\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0q1 =3D QuadraticForm(ZZ, 2 * t.T)\= \n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if q.det() =3D=3D q1.det():\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0u =3D q.is_globally_= equivalent_to(q1, return_matrix=3DTrue)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0if u and u.transpose() * q.Gram_matrix_rational() *= u =3D=3D q1.Gram_matrix_rational():\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0if u:= \\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0non_isoms.append((s.right_acti= on(u), a, g * u.transpose() ** (-1)))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0else:\\= n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0non_isoms.append((s, a, g))\\n = =C2=A0 =C2=A0return non_isoms\\n\\n\\n@cached_function\\ndef tp2_action_fc_= alist(p, T, i):\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0similar to = tp_action_fc_alist for T_i(p^2) for i =3D 0, 1, 2, 3.\\n =C2=A0 =C2=A0'= ''\\n =C2=A0 =C2=A0res1 =3D []\\n\\n =C2=A0 =C2=A0for alpha in alph= a_list(2):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0D =3D diagonal_matrix([p ** a for = a in alpha])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for V in _gl3_coset_gamma0(alpha= , p):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0M =3D D * V\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0S =3D T.right_action(M.transpose())\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if S.is_divisible_by(p ** 2):\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0S =3D S // (p ** 2)\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0res1.append((S, p **= (-12) * _expt_sum(S, p, alpha, i),\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 M ** (-1) * = p ** 2))\\n\\n =C2=A0 =C2=A0return __convert_reduced_nonisom_matrices([(a, = b, c) for a, b, c in res1 if b !=3D 0])\\n\\n\\ndef _nearest_integer(x):\\n= =C2=A0 =C2=A0r =3D floor(x)\\n =C2=A0 =C2=A0if x - r > 0.5:\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0return r + 1\\n =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0return r\\n\\n\\ndef _gaussian_reduction(b1, b2, S):\\n =C2=A0 = =C2=A0'''\\n =C2=A0 =C2=A0b1, b2: vectors of length 3\\n =C2=A0= =C2=A0S: symmetric matrix of size 3\\n =C2=A0 =C2=A0'''\\n =C2= =A0 =C2=A0while True:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0nb1 =3D b1 * S * b1\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0nb2 =3D b2 * S * b2\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0if nb2 < nb1:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0b1, b2 =3D = b2, b1\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0x =3D (b2 * S * b1) / (b1 * S * b1)\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0r =3D _nearest_integer(x)\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0a =3D b2 - r * b1\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0if a * S * a >= =3D b2 * S * b2:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (b1, b2= )\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0b1, b2 =3D a, b1\\n\\n\\ndef _sym_mat_gen(p, n):\\n =C2=A0 =C2=A0if = n =3D=3D 1:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for a in range(p):\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0yield matrix([[a]])\\n =C2=A0 =C2=A0else:\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0for s in _sym_mat_gen(p, n - 1):\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ls =3D [range(p) for _ in range(n)]\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for a in itertools.product(*ls):\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0v =3D matrix([a[:-1]= ])\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0yield block_ma= trix([[s, v.transpose()], [v, matrix([[a[-1]]])]])\\n\\n\\ndef _gen_gauss_s= um_direct_way(N, p, r):\\n =C2=A0 =C2=A0res =3D 0\\n =C2=A0 =C2=A0K =3D Cyc= lotomicField(p)\\n =C2=A0 =C2=A0zeta =3D K.gen()\\n =C2=A0 =C2=A0for S in _= sym_mat_gen(p, N.ncols()):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0if S.change_ring(F= initeField(p)).rank() =3D=3D r:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0res +=3D zeta ** ((N * S).trace())\\n =C2=A0 =C2=A0try:\\n =C2=A0 =C2=A0= =C2=A0 =C2=A0return QQ(res)\\n =C2=A0 =C2=A0except TypeError:\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0return res\\n\\n\\ndef _generalized_gauss_sum(N, p, r):= \\n =C2=A0 =C2=A0if r =3D=3D 0:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1\\n = =C2=A0 =C2=A0if p =3D=3D 2:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return _gen_gauss= _sum_direct_way(N, p, r)\\n =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0N_mp =3D N.change_ring(FiniteField(p))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0d, = _, v =3D N_mp.smith_form()\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0t =3D d.rank()\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0N1 =3D (v.transpose() * N_mp *\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0v).matrix_from_rows_and_columns(range(t),= range(t))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0eps =3D kronecker_symbol(N1.det(),= p)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return _gen_gauss_sum_non_dyadic(p, eps, = N.ncols(), t, r)\\n\\n\\ndef _half_int_mat_is_div_by(S, m):\\n =C2=A0 =C2= =A0n =3D S.ncols()\\n =C2=A0 =C2=A0return (all(ZZ(S[i, i]) % m =3D=3D 0 for= i in range(n)) and\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0all(ZZ(2 * = S[i, j]) % m =3D=3D 0 for i in range(n) for j in range(i + 1, n)))\\n\\n\\n= @cached_function\\ndef _gen_gauss_sum_non_dyadic(p, eps, n, t, r):\\n =C2= =A0 =C2=A0'''\\n =C2=A0 =C2=A0cf. H. Saito, a generalization of= Gauss sums\\n =C2=A0 =C2=A0'''\\n\\n =C2=A0 =C2=A0def parenthe= sis_prod(a, b, m):\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0if m =3D=3D 0:\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0el= se:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return mul(1 - a * b ** i f= or i in range(m))\\n\\n =C2=A0 =C2=A0if (n - t) % 2 =3D=3D 0:\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0m =3D (n - t) // 2\\n =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0m =3D (n - t + 1) // 2\\n\\n =C2=A0 =C2=A0if n =3D=3D r:\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0if n % 2 =3D=3D 1:\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0return ((-1) ** ((n - 2 * m + 1) // 2) * p ** ((n ** 2 + (= 2 * m) ** 2 - 1) // 4) *\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0parenthesis_prod(p ** (-1), p ** (-2), m))\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0elif n % 2 =3D=3D t % 2 =3D=3D 0:\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0return ((-kronecker_symbol(-1, p)) ** ((n - 2 * = m) // 2) *\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0eps * p ** ((n ** 2 + (2 * m + 1) ** 2 - 1) // 4) *\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parenthesis_prod= (p ** (-1), p ** (-2), m))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0else:\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0\\n =C2=A0 =C2=A0else:\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0diag =3D [1 for _ in range(t)]\\n =C2=A0 =C2=A0 =C2=A0 = =C2=A0if eps =3D=3D -1:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0diag[-1= ] =3D least_quadratic_nonresidue(p)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0diag =3D = diag + [0 for _ in range(n - t)]\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0N =3D diagon= al_matrix(diag).change_ring(FiniteField(p))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0r= eturn _gen_gauss_sum_direct_way(N, p, r)\\n\\n\\ndef _expt_sum(S, p, alpha,= i):\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0Return the exponential= sum in Miyawaki's paper, where alpha[-1] <=3D 2, for T_i(p^2).\\n = =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0a, b, c =3D [alpha.count(_i) f= or _i in range(3)]\\n =C2=A0 =C2=A0S33 =3D S.T.matrix_from_rows_and_columns= (range(a + b, 3), range(a + b, 3))\\n =C2=A0 =C2=A0S22 =3D S.T.matrix_from_= rows_and_columns(range(a, a + b), range(a, a + b))\\n =C2=A0 =C2=A0S32 =3D = S.T.matrix_from_rows_and_columns(range(a + b, 3), range(a))\\n\\n =C2=A0 = =C2=A0if c > 0 and not _half_int_mat_is_div_by(S33, p ** 2):\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0return 0\\n =C2=A0 =C2=A0if c > 0 and b > 0 and a= ny(x % p !=3D 0 for x in (S32 * ZZ(2)).change_ring(ZZ).list()):\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0return 0\\n\\n =C2=A0 =C2=A0if b =3D=3D 0 and a + c =3D= =3D 3 - i:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return p ** (c * (c + 1))\\n =C2= =A0 =C2=A0elif b =3D=3D 0:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0\\n =C2=A0= =C2=A0else:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0return p ** (c * (c + 1)) * p **= (b * c) * _generalized_gauss_sum(S22, p, b - i)\\n\\n\\ndef _minkowski_red= uction(b1, b2, b3, S):\\n\\n =C2=A0 =C2=A0def inner_prod(x, y):\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0return x * S * y\\n\\n =C2=A0 =C2=A0while True:\\n =C2= =A0 =C2=A0 =C2=A0 =C2=A0b1, b2, b3 =3D sorted([b1, b2, b3], key=3Dlambda b:= b * S * b)\\n\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0b1, b2 =3D _gaussian_reduction= (b1, b2, S)\\n\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0b11 =3D inner_prod(b1, b1)\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0b12 =3D inner_prod(b1, b2)\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0b13 =3D inner_prod(b1, b3)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0b22 =3D = inner_prod(b2, b2)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0b23 =3D inner_prod(b2, b3)= \\n =C2=A0 =C2=A0 =C2=A0 =C2=A0b33 =3D inner_prod(b3, b3)\\n\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0y1 =3D - (b13 / b11 - b12 * b23 / (b11 * b22)) / \\\\\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1 - b12 ** 2 / (b11 * b22))\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0y2 =3D - (b23 / b22 - b12 * b13 / (b11 * b22)) /= \\\\\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1 - b12 ** 2 / (b11 * b2= 2))\\n\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0# Find integers x1, x2 so that norm(b3= + x2 * b2 + x1 * b1) is minimal.\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0a_norms_als= t =3D []\\n\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0for x1 in [floor(y1), ceil(y1)]:\= \n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for x2 in [floor(y2), ceil(y2)]= :\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a =3D b3 + x2 *= b2 + x1 * b1\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a_n= orms_alst.append((x1, x2, a, inner_prod(a, a)))\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0_inner_prod_a =3D min(x[-1] for x in a_norms_alst)\\n =C2=A0 =C2=A0 =C2= =A0 =C2=A0x1, x2, a, _ =3D next(x for x in a_norms_alst if x[-1] =3D=3D _in= ner_prod_a)\\n\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0if _inner_prod_a >=3D b33:\= \n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Change sings of b1, b2, b3 an= d terminate the alogrithm\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sngs = =3D [sgn(b12), sgn(b13), sgn(b23)]\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0bs =3D [b1, b2, b3]\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0try:\= \n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# If b12, b13 or = b23 is zero, change sgns of b1, b2, b3 so that\\n =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# b12, b13, b23 >=3D 0.\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zero_i =3D sngs.index(0)\\n =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set_ls =3D [set([1, 2]), s= et([1, 3]), set([2, 3])]\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0t =3D set_ls[zero_i]\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0_other =3D [x for x in [1, 2, 3] if x not in t][0]\\n =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for x in t:\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0i =3D set_ls.ind= ex(set([x, _other]))\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0if sngs[i] < 0:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bs[x - 1] *=3D -1\\n = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0b1, b2, b3 =3D bs\\n= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0except ValueError:\\n =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Else change sgns so that b12= , b13 > 0\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if b= 12 < 0:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0b2 =3D -b2\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0if b13 < 0:\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0b3 =3D -b3\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= return (b1, b2, b3)\\n =C2=A0 =C2=A0 =C2=A0 =C2=A0else:\\n =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0b3 =3D a\\n\\n\\ndef _minkowski_reduction_transf= orm_matrix(S):\\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0Return a uni= modular matrix u such that u^t * S * u is reduced in Minkowski's sense.= \\n =C2=A0 =C2=A0'''\\n =C2=A0 =C2=A0b1, b2, b3 =3D identity_ma= trix(QQ, 3).columns()\\n =C2=A0 =C2=A0c1, c2, c3 =3D _minkowski_reduction(b= 1, b2, b3, S)\\n =C2=A0 =C2=A0return matrix([c1, c2, c3]).transpose()\\n\&q= uot;,\"line\":52,\"column\":41,\"path\":\&quo= t;/home/sho/work/sage_packages/e8theta_degree3/hecke_module.py\"}}&quo= t;

The file contains a multibyte string "=E2= =88=A7" and anaconda-mode converts it to "\342\210\247".

Sho Takemori


2016-07-31 23:31 GMT+09:00 Eli = Zaretskii <eliz@gnu.org>:
> = From: Sho Takemori <stakemorii@g= mail.com>
> Date: Sun, 31 Jul 2016 17:26:37 +0900
>
> I got an error "error in process sentinel: url-http-create-reques= t: Multibyte text in HTTP request" when I visited a
> Python file which contains a multibyte character with `anaconda-eldoc-= mode' turned on.

That file name should have been encoded by the time it is passed to
url-http.el, so the problem should not have happened, because encoded
strings are unibyte strings.

> At first, I thought this was a bug of anaconda-mode. So I opened an is= sue in github
> (https://github.com/proofit404/anaconda-m= ode/issues/189).
>
> I guess `(=3D (string-bytes request) (length request))` in `url-http-c= reate-request' should be `(=3D (string-bytes
> url-http-data) (length url-http-data))`, because `(=3D (string-bytes r= equest) (length request))` may be `nil' even if
> `(=3D (string-bytes url-http-data) (length url-http-data))` is `t'= .

I don't think I agree in general: all the strings that are used by
url-http-create-request should be unibyte strings.=C2=A0 if they all are unibyte strings, then I think the situation you describe should not
happen.=C2=A0 However, you didn't provide enough details to analyze the=
situation, so perhaps I'm missing something.=C2=A0 Could you please sho= w
all the details, specifically, what were the values of the various
variables used by url-http-create-request to generate the request?
For each value that is a string, please also tell whether it's a
unibyte or a multibyte string.

Thanks.

--94eb2c0481aef25b020538f6be7f--